Skip to content
Myr

Merge branch 'trim_args_section' of https://github.com/Rowlando13/click into trim_args_section

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

authored by unknown · committed by unknown · parents 63c03ab, fb325a4 · Browse files · 2 files+11 added−11 removed
This commit

State

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

Diff stats

2 files+11 added−11 removed

  • other:+11 added−11 removed

2 files+11 added−11 removed

modified:docs/arguments.rst+9 added-9 removed
3 unmodified lines
4=========56.. currentmodule:: click78Arguments : 8Arguments :910* are positional in nature 10* are positional in nature11* are very much like a limited version of :ref:`options <options>`12* but also can take an arbitrary number of inputs 13* must be :ref:`documented manually <documenting-arguments>` 12* but also can take an arbitrary number of inputs13* must be :ref:`documented manually <documenting-arguments>`1415Useful and often used kwargs are: 15Useful and often used kwargs are:1617* ``default`` : passes a default18* ``nargs`` : Sets the number of arguments. Set to -1 to take an arbitrary number. 18* ``nargs`` : Sets the number of arguments. Set to -1 to take an arbitrary number.1920Basic Argument21---------------22
15 unmodified lines
3839 invoke(touch, args=['foo.txt'])404142Not sure if should include : If no type is provided, the type of the default value is used, and if no default value is provided, the type is assumed to be STRING. 42Not sure if should include : If no type is provided, the type of the default value is used, and if no default value is provided, the type is assumed to be STRING.4344Multiple Arguments45-----------------------------------46
23 unmodified lines
7071Argument Escape Sequences72---------------------------7374If you want to process arguments that look like options, like a file named ``-foo.txt``, you must pass the ``--`` separator first. After you pass the ``--``, you may only pass arguments. This is a common feature for POSIX command line tools. 74If you want to process arguments that look like options, like a file named ``-foo.txt``, you must pass the ``--`` separator first. After you pass the ``--``, you may only pass arguments. This is a common feature for POSIX command line tools.7576Example usage:7778.. click:example::
49 unmodified lines
128129 with isolated_filesystem():130 with open('hello.txt', 'w') as f:131 f.write('Hello World!')132 invoke(echo, env={'SRC': 'hello.txt'})132 invoke(echo, env={'SRC': 'hello.txt'})
modified:docs/handling_files.rst+2 added-2 removed
1.. _handling-files:23Handling Files 3Handling Files4================56.. currentmodule:: click7
98 unmodified lines
106Starting with Click 2.0, it is also possible to open files in atomic mode by107passing ``atomic=True``. In atomic mode, all writes go into a separate108file in the same folder, and upon completion, the file will be moved over to109the original location. This is useful if a file regularly read by other110users is modified.110users is modified.