Skip to content

git example doesn't work #96

benoitc opened this Issue Feb 22, 2013 · 3 comments

2 participants

benoitc commented Feb 22, 2013

when I try the example i get the following error:

$ ./ -c a=b add
'a=b' is not a command. See 'git help'.

Also when I try with the same help documentation usage string I get the following result:

{"--bare": false,
 "--exec-path": null,
 "--git-dir": null,
 "--help": false,
 "--html-path": false,
 "--no-pager": false,
 "--no-replace-objects": false,
 "--paginate": false,
 "--version": false,
 "--work-tree": null,
 "-c": true,
 "-p": false,
 "<args>": ["a=b",
 "<command>": "git",
 "name=value": false} 
docopt member

the "try docopt" version is an older version, without support for options_first=True.

The problem lies, as I can see that docopt thinks that -c does not take an argument.

benoitc commented Feb 22, 2013

yes on another ex even with option_first=True i have such result as well insteadead of having key=value

docopt member

I see now, the option is stated as [-c name=value] and not described anywhere else. That means that docopt does not know that name=value is an argument to the -c options. To catch that it needs:

usage: git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [-c name=value] [--help]
           <command> [<args>]

  -c name=value

That will fix it. I will commit that later. Thanks for noting. There could be a couple of bugs in git examples like that.

@keleshev keleshev closed this in dc4b7d0 Mar 5, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.