Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument that is both boolean and string (git exec-path option) #114

Open
voieducode opened this issue Sep 3, 2021 · 1 comment
Open

Comments

@voieducode
Copy link
Member

Found an odd scenario in the git command line. Not sure how to handle this.

Git exec path oddity.

Usage:
 git [--exec-path[=<path>]] <command> [<args>]

Options:
  --exec-path[=<path>]
       Path to wherever your core Git programs are installed. This
       can also be controlled by setting the GIT_EXEC_PATH
       environment variable. If no path is given, git will print the
       current setting and then exit.

@atifaziz
Copy link
Collaborator

atifaziz commented Sep 3, 2021

I don't think we can expect that to work since the usage isn't valid per the docopt spec to date; options cannot have optional values themselves. There's even an issue open that specifically calls out the above case. What's unfortunate is that there's no error for a non-conforming usage so one is mislead to think that it will work, but in the above case, =<path> is seen as a command (see try.docopt.org). It's the same for docopt.net, which builds the following pattern tree:

Required:
Required:
    Optional:
    Option(,--exec-path,0,False)
    Optional:
        Command(=<path>, False)
    Argument(<command>, )
    Optional:
    Argument(<args>, )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants