summaryrefslogtreecommitdiff
path: root/docs/arguments.rst
diff options
context:
space:
mode:
authorKevin Yap <me@kevinyap.ca>2014-05-31 13:52:55 -0700
committerArmin Ronacher <armin.ronacher@active-4.com>2014-06-01 12:13:31 +0600
commit67523af3550c99afc29e1c6ce0b1581c45098c56 (patch)
treec0e0636e7e844e4b7e2478faa53bb1c2ba971384 /docs/arguments.rst
parentf48761a0566c25f7fe398ba5ba5bee7dfcfe168d (diff)
downloadclick-67523af3550c99afc29e1c6ce0b1581c45098c56.tar.gz
Documentation fixes
Diffstat (limited to 'docs/arguments.rst')
-rw-r--r--docs/arguments.rst58
1 files changed, 29 insertions, 29 deletions
diff --git a/docs/arguments.rst b/docs/arguments.rst
index 200df25..cfbaf36 100644
--- a/docs/arguments.rst
+++ b/docs/arguments.rst
@@ -3,17 +3,17 @@ Arguments
.. currentmodule:: click
-Arguments work similar to options but are positional. They also only
+Arguments work similarly to options, but are positional. They also only
support a subset of the features of options due to their syntactical nature.
-Click also will not attempt to document arguments for you and wants you to
-document them manually to avoid ugly looking help pages.
+Click will also not attempt to document arguments for you and wants you to
+document them manually in order to avoid ugly help pages.
Basic Arguments
---------------
The most basic option is a simple string argument of one value. If no
-type is provided the type of the default value is used. If no default
-value is provided the type is assumed to be :data:`STRING`.
+type is provided, the type of the default value is used, and if no default
+value is provided, the type is assumed to be :data:`STRING`.
Example:
@@ -35,11 +35,11 @@ Variadic Arguments
The second most common version is variadic arguments where a specific (or
unlimited) number of arguments is accepted. This can be controlled with
-the ``nargs`` parameter. If it's set to ``-1`` then an unlimited number
+the ``nargs`` parameter. If it is set to ``-1``, then an unlimited number
of arguments is accepted.
The value is then passed as a tuple. Note that only one argument can be
-set to ``nargs=-1`` as this will eat up all arguments.
+set to ``nargs=-1``, as it will eat up all arguments.
Example:
@@ -60,9 +60,9 @@ And what it looks like:
Note that this is not how you would write this application. The reason
for this is that in this particular example the arguments are defined as
-strings. File names however are not strings! They might be (on certain
-operating systems) but not necessarily on others. For better ways see the
-next sections.
+strings. Filenames, however, are not strings! They might be on certain
+operating systems, but not necessarily on all. For better ways to write
+this, see the next sections.
.. admonition:: Note on Non-Empty Variadic Arguments
@@ -83,7 +83,7 @@ File Arguments
Since all the examples have already worked with filenames, it makes sense
to explain how to deal with files properly. Command line tools are more
-fun if they work with files the Unix way which is to accept ``-`` as a
+fun if they work with files the Unix way, which is to accept ``-`` as a
special file that refers to stdin/stdout.
Click supports this through the :class:`click.File` type which
@@ -118,12 +118,12 @@ File Path Arguments
In the previous example the files were opened immediately. But what if
we just want the filename? The naive way is to use the default string
-argument type. However remember that click is unicode based so the string
-will be a unicode value always. Filenames unfortunately however can be
-unicode or bytes depending on which operating system you're on. As such
-the type is insufficient.
+argument type. However, remember that click is Unicode-based, so the string
+will always be a Unicode value. Unfortunately, filenames can be Unicode or
+bytes depending on which operating system is being used. As such, the type
+is insufficient.
-Instead, you should be using the :class:`Path` type which handles this
+Instead, you should be using the :class:`Path` type, which handles this
complexity for you. Not only will it return either bytes or Unicode
depending on what makes more sense, but it will also be able to do some
basic checks for you such as existence checks.
@@ -152,16 +152,16 @@ And what it does:
File Opening Safety
-------------------
-The :class:`FileType` type has one problem it needs to deal with and that
+The :class:`FileType` type has one problem it needs to deal with, and that
is to decide when to open a file. The default behavior is to be
"intelligent" about it. What this means is that it will open stdin/stdout
-and files opened for reading immediately. This will directly give the
-user feedback when a file cannot be opened, but it will only open files
-for writing the first time an IO operation is performed by wrapping the
-file automatically in a special wrapper.
+and files opened for reading immediately. This will give the user direct
+feedback when a file cannot be opened, but it will only open files
+for writing the first time an IO operation is performed by automatically
+wrapping the file in a special wrapper.
This behavior can be forced by passing ``lazy=True`` or ``lazy=False`` to
-the constructor. If the file is opened lazily, it will fail on first IO
+the constructor. If the file is opened lazily, it will fail its first IO
operation by raising an :exc:`FileError`.
Since files opened for writing will typically immediately empty the file,
@@ -176,16 +176,16 @@ necessary for manually prompting with the :func:`prompt` function as you
do not know if a stream like stdout was opened (which was already open
before) or a real file that needs closing.
-Starting with click 2.0 it's also possible to open files in atomic mode by
+Starting with click 2.0, it is also possible to open files in atomic mode by
passing ``atomic=True``. In atomic mode, all writes go into a separate
-file in the same folder and upon completion the file will be moved over to
+file in the same folder, and upon completion, the file will be moved over to
the original location. This is useful if a file regularly read by other
users is modified.
Environment Variables
---------------------
-Like options, arguments can also get values from an environment variable.
+Like options, arguments can also grab values from an environment variable.
Unlike options, however, this is only supported for explicitly named
environment variables.
@@ -210,13 +210,13 @@ And from the command line:
In that case, it can also be a list of different environment variables
where the first one is picked.
-Generally this feature is not recommended because it can cause a lot of
-confusion to the user.
+Generally, this feature is not recommended because it can cause the user
+a lot of confusion.
-Arguments-Like Options
+Argument-Like Options
------------------------------
-Sometimes you want to process arguments that look like options. For
+Sometimes, you want to process arguments that look like options. For
instance, imagine you have a file named ``-foo.txt``. If you pass this as
an argument in this manner, click will treat it as an option.