質問

I want to add an option to the mercurial command hg incomming and a specific behavior. Here is what I've done:

entry = extensions.wrapcommand(commands.table, 'incoming', specific_behavior)
entry[1].append(('', 'newopt', '', _('NEW OPT HELP STRING'), _('OPTION_ARGUMENT')))

Currently the OPTION_ARGUMENT is required but I want it optional. Any idea ?

Thanks

役に立ちましたか?

解決

It looks like the only default values allowed are None, True or False. So if you set the default value '' a value has to be passed in that will be passed to your function as a string.

http://hg.intevation.org/mercurial/crew/file/tip/mercurial/fancyopts.py#l85

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top