Skip to content
Myr

Mentioned "--" in the docs.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent c8a202d · Browse files · 1 file+28 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+28 added−0 removed

  • other:+28 added−0 removed

1 file+28 added−0 removed

modified:docs/arguments.rst+28 added
167 unmodified lines
168where the first one is picked.169170Generally this feature is not recommended because it can cause a lot of171confusion to the user.172173Arguments looking like Options174------------------------------175176Sometimes you want to process arguments that look like options. For177instance imagine you have a file named ``-foo.txt``. If you pass this as178such as an argument click will treat it as an option.179180To solve this, click does what any POSIX style command line script does181and that is to accept the string ``--`` as a separator for options and182arguments. After the ``--`` marker all further parameters are accepted as183arguments.184185Example usage:186187.. click:example::188189 @click.command()190 @click.argument('files', nargs=-1, type=click.Path())191 def touch(files):192 for filename in files:193 click.echo(filename)194195And from the command line:196197.. click:run::198199 invoke(touch, ['--', '-foo.txt', 'bar.txt'])