on master help sign in
Simplify -h help text
commitf9fd5e485173adf71b44888f72980577f16ddcf7 authorsharkdp <davidpeter@web.de> dateSun 7 Oct 2018, 10:43 (8 years ago) parentda09f38
1 file changed+36−25
src/clap_app.rs+36−25
src/clap_app.rs+36−25
@@ -17,12 +17,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
1717 .global_setting(clap_color_setting)
1818 .global_setting(AppSettings::DeriveDisplayOrder)
1919 .global_setting(AppSettings::UnifiedHelpMessage)
20− .global_setting(AppSettings::NextLineHelp)
20+ .global_setting(AppSettings::HidePossibleValuesInHelp)
2121 .setting(AppSettings::InferSubcommands)
2222 .setting(AppSettings::ArgsNegateSubcommands)
2323 .setting(AppSettings::DisableHelpSubcommand)
2424 .setting(AppSettings::VersionlessSubcommands)
25− .max_term_width(90)
25+ .max_term_width(100)
2626 .about(
2727 "A cat(1) clone with wings.\n\n\
2828 Use '--help' instead of '-h' to see a more detailed version of the help text.",
@@ -87,14 +87,18 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
8787 .possible_values(&[
8888 "auto", "full", "plain", "changes", "header", "grid", "numbers",
8989 ])
90− .help("Comma-separated list of style elements to display.")
90+ .help(
91+ "Comma-separated list of style elements to display \
92+ (*auto*, full, plain, changes, header, grid, numbers).",
93+ )
9194 .long_help(
9295 "Configure which elements (line numbers, file headers, grid \
9396 borders, Git modifications, ..) to display in addition to the \
9497 file contents. The argument is a comma-separated list of \
9598 components to display (e.g. 'numbers,changes,grid') or a \
9699 pre-defined style ('full'). To set a default theme, export the \
97− BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"numbers\").",
100+ BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"numbers\"). \
101+ Possible values: *auto*, full, plain, changes, header, grid, numbers.",
98102 ),
99103 )
100104 .arg(
@@ -144,11 +148,13 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
144148 .takes_value(true)
145149 .value_name("when")
146150 .possible_values(&["auto", "never", "always"])
151+ .hide_default_value(true)
147152 .default_value("auto")
148− .help("When to use colors.")
153+ .help("When to use colors (*auto*, never, always).")
149154 .long_help(
150155 "Specify when to use colored output. The automatic mode \
151− only enables colors if an interactive terminal is detected.",
156+ only enables colors if an interactive terminal is detected. \
157+ Possible values: *auto*, never, always.",
152158 ),
153159 )
154160 .arg(
@@ -159,11 +165,12 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
159165 .value_name("when")
160166 .possible_values(&["auto", "never", "always"])
161167 .default_value("auto")
162− .help("When to show the decorations specified by '--style'.")
168+ .hide_default_value(true)
169+ .help("When to show the decorations (*auto*, never, always).")
163170 .long_help(
164171 "Specify when to use the decorations that have been specified \
165172 via '--style'. The automatic mode only enables decorations if \
166− an interactive terminal is detected.",
173+ an interactive terminal is detected. Possible values: *auto*, never, always.",
167174 ),
168175 )
169176 .arg(
@@ -174,13 +181,15 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
174181 .value_name("when")
175182 .possible_values(&["auto", "never", "always"])
176183 .default_value("auto")
177− .help("Specify when to use the pager.")
184+ .hide_default_value(true)
185+ .help("Specify when to use the pager (*auto*, never, always).")
178186 .long_help(
179187 "Specify when to use the pager. To control which pager \
180188 is used, set the PAGER or BAT_PAGER environment \
181189 variables (the latter takes precedence). The default \
182190 pager is 'less'. To disable the pager permanently, set \
183− BAT_PAGER to an empty string.",
191+ BAT_PAGER to an empty string. \
192+ Possible values: *auto*, never, always.",
184193 ),
185194 )
186195 .arg(
@@ -191,24 +200,15 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
191200 .value_name("mode")
192201 .possible_values(&["auto", "never", "character"])
193202 .default_value("auto")
194− .help("Specify the text-wrapping mode.")
195− .long_help("Specify the text-wrapping mode."),
196− )
197− .arg(
198− Arg::with_name("unbuffered")
199− .short("u")
200− .hidden_short_help(true)
201− .long_help(
202− "This option exists for POSIX-compliance reasons ('u' is for \
203− 'unbuffered'). The output is always unbuffered - this option \
204− is simply ignored.",
205− ),
203+ .hide_default_value(true)
204+ .help("Specify the text-wrapping mode (*auto*, never, character).")
205+ .long_help("Specify the text-wrapping mode (*auto*, never, character)."),
206206 )
207207 .arg(
208208 Arg::with_name("tabs")
209209 .long("tabs")
210210 .takes_value(true)
211− .value_name("tabs")
211+ .value_name("T")
212212 .validator(
213213 |t| {
214214 t.parse::<u32>()
@@ -217,12 +217,23 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
217217 .map_err(|e| e.to_string())
218218 }, // Convert to Result<(), String>
219219 )
220− .help("Sets the tab width.")
220+ .help("Set the tab width to T spaces.")
221221 .long_help(
222− "Sets the tab width. Use a width of 0 to pass tabs through \
222+ "Set the tab width to T spaces. Use a width of 0 to pass tabs through \
223223 directly",
224224 ),
225225 )
226+ .arg(
227+ Arg::with_name("unbuffered")
228+ .short("u")
229+ .long("unbuffered")
230+ .hidden_short_help(true)
231+ .long_help(
232+ "This option exists for POSIX-compliance reasons ('u' is for \
233+ 'unbuffered'). The output is always unbuffered - this option \
234+ is simply ignored.",
235+ ),
236+ )
226237 .arg(
227238 Arg::with_name("terminal-width")
228239 .long("terminal-width")