Skip to content

Commit 167c707

Browse files
committed
Refresh cmdline documentation
Would have used https://sphinxcontrib-autoprogram.readthedocs.io/en/stable/ if we used argparse... Fixes #771
1 parent 381557d commit 167c707

1 file changed

Lines changed: 69 additions & 44 deletions

File tree

docs/cmdline.rst

Lines changed: 69 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ systems.
1414
When properly installed, Babel provides a script called ``pybabel``::
1515

1616
$ pybabel --help
17-
usage: pybabel command [options] [args]
17+
Usage: pybabel command [options] [args]
1818

19-
options:
19+
Options:
2020
--version show program's version number and exit
2121
-h, --help show this help message and exit
2222
--list-locales print all known locales and exit
@@ -40,24 +40,25 @@ The ``compile`` sub-command can be used to compile translation catalogs into
4040
binary MO files::
4141

4242
$ pybabel compile --help
43-
usage: pybabel compile [options]
43+
Usage: pybabel compile [options]
4444

4545
compile message catalogs to MO files
4646

47-
options:
47+
Options:
4848
-h, --help show this help message and exit
4949
-D DOMAIN, --domain=DOMAIN
50-
domain of MO and PO files (default 'messages')
51-
-d DIR, --directory=DIR
52-
base directory of catalog files
53-
-l LOCALE, --locale=LOCALE
54-
locale of the catalog
55-
-i FILE, --input-file=FILE
50+
domains of PO files (space separated list, default
51+
'messages')
52+
-d DIRECTORY, --directory=DIRECTORY
53+
path to base directory containing the catalogs
54+
-i INPUT_FILE, --input-file=INPUT_FILE
5655
name of the input file
57-
-o FILE, --output-file=FILE
56+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
5857
name of the output file (default
5958
'<output_dir>/<locale>/LC_MESSAGES/<domain>.mo')
60-
-f, --use-fuzzy also include fuzzy translations (default False)
59+
-l LOCALE, --locale=LOCALE
60+
locale of the catalog to compile
61+
-f, --use-fuzzy also include fuzzy translations
6162
--statistics print statistics about translations
6263

6364
If ``directory`` is specified, but ``output-file`` is not, the default filename
@@ -77,39 +78,53 @@ The ``extract`` sub-command can be used to extract localizable messages from
7778
a collection of source files::
7879

7980
$ pybabel extract --help
80-
usage: pybabel extract [options] dir1 <dir2> ...
81+
Usage: pybabel extract [options] <input-paths>
8182

8283
extract messages from source files and generate a POT file
8384

84-
options:
85+
Options:
8586
-h, --help show this help message and exit
86-
--charset=CHARSET charset to use in the output (default "utf-8")
87-
-k KEYWORDS, --keyword=KEYWORDS
88-
keywords to look for in addition to the defaults. You
89-
can specify multiple -k flags on the command line.
87+
--charset=CHARSET charset to use in the output file (default "utf-8")
88+
-k KEYWORDS, --keywords=KEYWORDS, --keyword=KEYWORDS
89+
space-separated list of keywords to look for in
90+
addition to the defaults (may be repeated multiple
91+
times)
9092
--no-default-keywords
9193
do not include the default keywords
92-
-F MAPPING_FILE, --mapping=MAPPING_FILE
93-
path to the extraction mapping file
94+
-F MAPPING_FILE, --mapping-file=MAPPING_FILE, --mapping=MAPPING_FILE
95+
path to the mapping configuration file
9496
--no-location do not include location comments with filename and
9597
line number
98+
--add-location=ADD_LOCATION
99+
location lines format. If it is not given or "full",
100+
it generates the lines with both file name and line
101+
number. If it is "file", the line number part is
102+
omitted. If it is "never", it completely suppresses
103+
the lines (same as --no-location).
96104
--omit-header do not include msgid "" entry in header
97-
-o OUTPUT, --output=OUTPUT
98-
path to the output POT file
105+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE, --output=OUTPUT_FILE
106+
name of the output file
99107
-w WIDTH, --width=WIDTH
100108
set output line width (default 76)
101109
--no-wrap do not break long message lines, longer than the
102110
output line width, into several lines
103111
--sort-output generate sorted output (default False)
104112
--sort-by-file sort output by file location (default False)
105-
--msgid-bugs-address=EMAIL@ADDRESS
113+
--msgid-bugs-address=MSGID_BUGS_ADDRESS
106114
set report address for msgid
107115
--copyright-holder=COPYRIGHT_HOLDER
108116
set copyright holder in output
109-
-c TAG, --add-comments=TAG
117+
--project=PROJECT set project name in output
118+
--version=VERSION set project version in output
119+
-c ADD_COMMENTS, --add-comments=ADD_COMMENTS
110120
place comment block with TAG (or those preceding
111-
keyword lines) in output file. One TAG per argument
112-
call
121+
keyword lines) in output file. Separate multiple TAGs
122+
with commas(,)
123+
-s, --strip-comments, --strip-comment-tags
124+
strip the comment TAGs from the comments.
125+
--input-dirs=INPUT_DIRS
126+
alias for input-paths (does allow files as well as
127+
directories).
113128

114129

115130
init
@@ -119,24 +134,27 @@ The `init` sub-command creates a new translations catalog based on a PO
119134
template file::
120135

121136
$ pybabel init --help
122-
usage: pybabel init [options]
137+
Usage: pybabel init [options]
123138

124139
create new message catalogs from a POT file
125140

126-
options:
141+
Options:
127142
-h, --help show this help message and exit
128143
-D DOMAIN, --domain=DOMAIN
129144
domain of PO file (default 'messages')
130-
-i FILE, --input-file=FILE
145+
-i INPUT_FILE, --input-file=INPUT_FILE
131146
name of the input file
132-
-d DIR, --output-dir=DIR
147+
-d OUTPUT_DIR, --output-dir=OUTPUT_DIR
133148
path to output directory
134-
-o FILE, --output-file=FILE
149+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
135150
name of the output file (default
136151
'<output_dir>/<locale>/LC_MESSAGES/<domain>.po')
137152
-l LOCALE, --locale=LOCALE
138153
locale for the new localized catalog
139-
154+
-w WIDTH, --width=WIDTH
155+
set output line width (default 76)
156+
--no-wrap do not break long message lines, longer than the
157+
output line width, into several lines
140158

141159
update
142160
======
@@ -145,29 +163,36 @@ The `update` sub-command updates an existing new translations catalog based on
145163
a PO template file::
146164

147165
$ pybabel update --help
148-
usage: pybabel update [options]
166+
Usage: pybabel update [options]
149167

150168
update existing message catalogs from a POT file
151169

152-
options:
170+
Options:
153171
-h, --help show this help message and exit
154172
-D DOMAIN, --domain=DOMAIN
155173
domain of PO file (default 'messages')
156-
-i FILE, --input-file=FILE
174+
-i INPUT_FILE, --input-file=INPUT_FILE
157175
name of the input file
158-
-d DIR, --output-dir=DIR
159-
path to output directory
160-
-o FILE, --output-file=FILE
176+
-d OUTPUT_DIR, --output-dir=OUTPUT_DIR
177+
path to base directory containing the catalogs
178+
-o OUTPUT_FILE, --output-file=OUTPUT_FILE
161179
name of the output file (default
162180
'<output_dir>/<locale>/LC_MESSAGES/<domain>.po')
181+
--omit-header do not include msgid entry in header
163182
-l LOCALE, --locale=LOCALE
164-
locale of the translations catalog
165-
--ignore-obsolete do not include obsolete messages in the output
166-
(default False)
183+
locale of the catalog to compile
184+
-w WIDTH, --width=WIDTH
185+
set output line width (default 76)
186+
--no-wrap do not break long message lines, longer than the
187+
output line width, into several lines
188+
--ignore-obsolete whether to omit obsolete messages from the output
189+
--init-missing if any output files are missing, initialize them first
167190
-N, --no-fuzzy-matching
168-
do not use fuzzy matching (default False)
169-
--previous keep previous msgids of translated messages (default
170-
False)
191+
do not use fuzzy matching
192+
--update-header-comment
193+
update target header comment
194+
--previous keep previous msgids of translated messages
195+
171196

172197
If ``output_dir`` is specified, but ``output-file`` is not, the default
173198
filename of the output file will be::

0 commit comments

Comments
 (0)