Skip to content
Myr

another way to realize Option-Like Arguments

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

authored by Ju Lin · committed by Ju Lin · parent 67f39e4 · Browse files · 1 file+18 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+18 added−0 removed

  • other:+18 added−0 removed

1 file+18 added−0 removed

modified:docs/arguments.rst+18 added
241 unmodified lines
242243.. click:run::244245 invoke(touch, ['--', '-foo.txt', 'bar.txt'])246247If you don't like the '--' marker, you can set ignore_unknown_options to248True to avoid checking unknown options:249250.. click:example::251252 @click.command(context_settings={"ignore_unknown_options": True})253 @click.argument('files', nargs=-1, type=click.Path())254 def touch(files):255 for filename in files:256 click.echo(filename)257258And from the command line:259260.. click:run::261262 invoke(touch, ['-foo.txt', 'bar.txt'])263