Lucretiel / autocommand

Autocommand turns a python function into a CLI program
GNU Lesser General Public License v3.0
53 stars 9 forks source link

Support dash-separated names #29

Open jaraco opened 7 months ago

jaraco commented 7 months ago

I recently tried:

@autocommand
def main(dry_run=False):
  ...

And it created an option --dry_run, which was a surprised because other parts of autocommand seem to use - as the separator (e.g. --no- for negation).

It would be nice if there were an option to substitute the underscore for a dash, e.g.

@autocommand(preferred_separator='-')
def main(dry_run=False):
  ...

Would then expect --dry-run and --no-dry-run as the options.

Lucretiel commented 7 months ago

This has been on my list for a while! When I first designed it, I actually deliberately wanted the no- vs _ behavior, because it mean there wasn't any possibility of a name collision. I've since come to the pretty obvious conclusion that that's not worth worrying about. Thanks for the ticket.