1

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

Lpmat
  • 29
  • 9
  • How does it fail if you don't pass it? (With `--traceback`.) AFAICT it mostly depends on your `specific_behavior()` function. – djc Dec 19 '12 at 14:54
  • The specific_behavior() function is never called. Mercurial just answer me : hg incoming: option --newopt requires argument – Lpmat Dec 19 '12 at 15:00

1 Answers1

0

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

djc
  • 11,603
  • 5
  • 41
  • 54