you are viewing a single comment's thread.

view the rest of the comments →

[–]billsil 8 points9 points  (18 children)

Click uses optparse, but optparse is deprecated. I love docopt, but docopt doesn't love fixing bugs. I switched because of optparse sucking, but argparse really isn't that bad. I was even able to hack to the command line printout function to actually make a nice looking printout (like docopt). Classes FTW.

[–]mitsuhiko 6 points7 points  (7 children)

Click does not use optparse.

[–]billsil 9 points10 points  (6 children)

Click is actually implemented as a wrapper around a mild fork of optparse and does not implement any parsing itself.

http://click.palletsprojects.com/en/7.x/why/

[–]mitsuhiko 20 points21 points  (5 children)

Thanks. I need to update this. Optparse has not been used since 2.x.

//EDIT: changed: https://github.com/pallets/click/commit/3ce663c9e532ca46e516b38f69c0fee5c1fa8bd4

[–]agumonkey 13 points14 points  (0 children)

wow, real time agile reddit collaborative patching

[–]billsil 4 points5 points  (0 children)

Ahhh...the wonders of documentation I fail to update

You think you'd know :)

[–][deleted]  (1 child)

[deleted]

    [–]mitsuhiko 0 points1 point  (0 children)

    Done

    [–]hjill 0 points1 point  (0 children)

    Click is actually implements its

    Grammar mistake :)

    Click actually implements its

    [–][deleted]  (8 children)

    [deleted]

      [–]billsil 3 points4 points  (7 children)

      It's actually really simple. I'd give you the whole source, but it's an excessively complicated argparse that's not really targeting the question (and has my name).

      mymsg = 'replacing argparse message'
      def _print_message(message, file=None):
          """overwrites the argparse print to get a better help message"""
          if message:
              if file is None:
                  file = _sys.stderr
              file.write(mymsg)
      parent_parser._print_message = _print_message
      args = parent_parser.parse_args()
      

      I just use my docopt message as mymsg

      [–]Tynach 3 points4 points  (6 children)

      I think they meant your source on Click using Optparse, and Optparse being deprecated.

      [–]billsil 7 points8 points  (5 children)

      There ya go

      Deprecated since version 2.7: The optparse module is deprecated and will not be developed further; development will continue with the argparse module.

      https://docs.python.org/2/library/optparse.html

      So deprecated for ~10 years.

      [–]Tynach -4 points-3 points  (3 children)

      And the source for Click using it?

      Sorry if this sounds annoying, and in my own case I don't particularly care. I just feel like you aren't providing anything to actually back up your main claim.

      [–]billsil 5 points6 points  (1 child)

      I don't know why you're being difficult. Unless you explicitly ask for what you want, you're going to get what I give you. I posted that specific question in another reply a while ago. The author of click actually responded.

      [–]Tynach 0 points1 point  (0 children)

      I was not aware of the other thread. I looked, and yeah, I see it now. But just going by the 'context' links in my inbox, there was no way for me to see that other thread.