tellapart/commandr

Converting options with underscore symbols to the hyphen/dash symbol

rubiojr opened this issue · 5 comments

This is a feature request folks, for the very nice commander!

It would be great to have option names like 'test_option' parsed as '--test-option' instead of '--test_option'. The reason is, perhaps, that there's a long tradition of options being parsed that way.

Since you may want to keep backwards compatibility, perhaps accepting both would be great and maybe display the built-in command help with the more common hyphen symbol instead of the underscore.

That is:

@command('run')
def run(test_option = 'foo'):
    pass

Would accept both --test-option and --test_option but the built-in help for the command would display --test-option.

Thanks!

Thanks for the suggestion. This is a good idea -- we'll probably integrate something like this into the next release.

Awesome @kevinballard, thanks!

Integrated into release 1.1.0.

awesome! thanks.