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

short option does not parse "=" and recognizes it as part of the option string #2436

Closed
likewei92 opened this issue Jan 19, 2023 · 1 comment

Comments

@likewei92
Copy link

likewei92 commented Jan 19, 2023

If we have an option that can called with -x, using -x=test will give =test as x instead of test.

Using example from https://click.palletsprojects.com/en/8.1.x/options/#name-your-options

test.py:

import click

@click.command()
@click.option('-s', '--string-to-echo')
def echo(string_to_echo):
    click.echo(string_to_echo)

if __name__ == "__main__":
    echo()

try running python test.py -s=test_string, the output is =test_string. Using the long name python test.py --string-to-echo=test_string gives the right output of test_string.

Environment: MacOS

  • Python version: 3.11
  • Click version: 8.1.3
@davidism
Copy link
Member

That's correct, that's the semantics of short option values. = is only a separator for long options.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants