Skip to content
Myr

edits to arguments.rst and commands.rst

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

authored by epequeno · committed by epequeno · parent 24efee0 · Browse files · 2 files+5 added−5 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+5 added−5 removed

  • other:+5 added−5 removed

2 files+5 added−5 removed

modified:docs/arguments.rst+3 added-3 removed
2 unmodified lines
34.. currentmodule:: click56Arguments work similar to options but are positional. They also only7support subset of the features of options due to their syntactical nature.7support a subset of the features of options due to their syntactical nature.8Click also will not attempt to document arguments for you and wants you to9document them manually to avoid ugly looking help pages.1011Basic Arguments12---------------1314The most basic option is a simple string arguments of one value. If no14The most basic option is a simple string argument of one value. If no15type is provided the type of the default value is used. If no default16value is provided the type is assumed to be :data:`STRING`.1718Example::
37 unmodified lines
56--------------5758Since all the examples have already worked with file names it makes sense59to explain how to deal with files properly. Command line tools are more60fun if they work with files the unix way which is to accept ``-`` as60fun if they work with files the unix way which is to accept ``-`` as a61special file that refers to stdin/stdout.6263Click supports this through the :class:`click.File` type which64intelligently handles files for you. It also deals with unicode and bytes
50 unmodified lines
modified:docs/commands.rst+2 added-2 removed
56 unmodified lines
57debug argument which is passed to its callback, but not to the sync58command itself. The sync command only accepts its own arguments.5960This allows tools to act completely independent of each other. But how61does on command talk to a nested on? The answer to this is the61does one command talk to a nested one? The answer to this is the62:class:`Context`.6364Each time a command invokes a new context is created and linked with the64Each time a command is invoked a new context is created and linked with the65parent context. Normally you can't see these contexts, but they are66there. Contexts are passed to parameter callbacks together with the67value automatically. Commands can also ask for the context to be passed68by marking themselves with the :func:`pass_context` decorator. In that
140 unmodified lines