Skip to content
Myr

Docs: fixes

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

authored by Julen Ruiz Aizpuru · committed by Julen Ruiz Aizpuru · parent 5d85db9 · Browse files · 3 files+8 added−8 removed
This commit

State

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

Diff stats

3 files+8 added−8 removed

  • other:+8 added−8 removed

3 files+8 added−8 removed

modified:click/formatting.py+1 added-1 removed
201 unmodified lines
202 def section(self, name):203 """Helpful context manager that writes a paragraph, a heading204 and the indents.205206 :param name: the section name taht is written as heading.206 :param name: the section name that is written as heading.207 """208 self.write_paragraph()209 self.write_heading(name)210 self.indent()
17 unmodified lines
modified:docs/complex.rst+3 added-3 removed
10 unmodified lines
11realized that it provides a command line utility. But so does Celery for12instance. So when using Celery with Django there are two tools that need13to interact with each other and be cross configured.1415In a theoretical world of two separate Click command line utilities they15In a theoretical world of two separate click command line utilities they16can solve this problem by nesting one inside the other. For instance the17web framework could also load the commands for the message queue18framework.19
5 unmodified lines
2526Contexts27````````2829Whenever a Click command is executed a :class:`Context` object is created29Whenever a click command is executed a :class:`Context` object is created30which holds state for this particular invocation. For instance it31remembers parsed parameters, what command created it, which resources need32to be cleaned up at the end of the function and so forth. It also holds33an application defined object optionally.
11 unmodified lines
4546Calling Convention47``````````````````4849When a Click command callback is executed it's passed all the non hidden49When a click command callback is executed it's passed all the non hidden50parameters as keyword arguments. Notably absent is the context. However51a callback can opt-into being passed the context object by marking itself52with :func:`pass_context`.53
166 unmodified lines
modified:docs/why.rst+4 added-4 removed
69 unmodified lines
70Python library that tries to aim for composability of applications that71goes beyond what the system itself supports.7273Docopt for instance acts by parsing your help pages and then parsing74according do those rules. The side effect of this is that docopt is quite74according to those rules. The side effect of this is that docopt is quite75rigid in how it handles the command line interface. The upside of docopt76is that it gives you strong control over your help page, the downside is77that due to that it cannot rewrap your output for the current terminal78width and it makes translations hard. On top of that docopt is restricted
5 unmodified lines
84support dispatching to subcommands, it for instance does not directly85support any kind of automatic subcommand enumeration based on what's86available or it does not enforce subcommands to work in a consistent way.8788This is fine, but it's different from how Click wants to work. Click aims88This is fine, but it's different from how click wants to work. Click aims89to support fully composable command line user interfaces by doing this:9091- click does not just parse, it also dispatches to the appropriate code91- click does not just parse, it also dispatches to the appropriate code.92- click has a strong concept of an invocation context that allows93 subcommands to respond to data from the parent command.94- click has strong information available for all parameters and commands95 so that it can generate unified help pages for the full CLI and to
1 unmodified line
97- click has strong understanding of what types are and can give the user98 consistent error messages if something goes wrong. A subcommand99 written by a different developer will not suddenly die with a100 different error messsage because it's manually handled.101- click has enough meta information available for it's whole program101- click has enough meta information available for its whole program102 that it can evolve over time to improve the user experience without103 forcing developers to adjust their programs. For instance if click104 decides to change how help pages are formatted, all click programs105 will automatically benefit from this.
27 unmodified lines