mirror of
https://github.com/sharkdp/bat.git
synced 2025-02-28 15:58:31 +00:00
Extended help texts for '--help'
This commit is contained in:
parent
d1a1943998
commit
be0a2d6048
71
src/app.rs
71
src/app.rs
@ -45,35 +45,58 @@ impl App {
|
|||||||
.setting(AppSettings::DisableHelpSubcommand)
|
.setting(AppSettings::DisableHelpSubcommand)
|
||||||
.setting(AppSettings::VersionlessSubcommands)
|
.setting(AppSettings::VersionlessSubcommands)
|
||||||
.max_term_width(90)
|
.max_term_width(90)
|
||||||
.about(crate_description!())
|
.about(
|
||||||
|
"A cat(1) clone with wings.\n\n\
|
||||||
|
Use '--help' instead of '-h' to see a more detailed version of the help text.",
|
||||||
|
)
|
||||||
|
.long_about("A cat(1) clone with syntax highlighting and Git integration.")
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("language")
|
Arg::with_name("language")
|
||||||
.short("l")
|
.short("l")
|
||||||
.long("language")
|
.long("language")
|
||||||
.help("Set the language for highlighting")
|
.help("Set the language for highlighting")
|
||||||
|
.long_help(
|
||||||
|
"Set the language for syntax highlighting. The language can be \
|
||||||
|
specified as a name (like 'C++' or 'LaTeX') or possible file \
|
||||||
|
extension (like 'cpp', 'hpp' or 'md'). Use '--list-languages' \
|
||||||
|
to show all supported language names and file extensions",
|
||||||
|
)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("FILE")
|
Arg::with_name("FILE")
|
||||||
.help("File(s) to print")
|
.help("File(s) to print / concatenate. Use '-' for standard input.")
|
||||||
|
.long_help(
|
||||||
|
"File(s) to print. Use no argument or '-' to read from standard \
|
||||||
|
input",
|
||||||
|
)
|
||||||
.multiple(true)
|
.multiple(true)
|
||||||
.empty_values(false),
|
.empty_values(false),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("style")
|
Arg::with_name("style")
|
||||||
.long("style")
|
.long("style")
|
||||||
|
.value_name("style-components")
|
||||||
.use_delimiter(true)
|
.use_delimiter(true)
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.possible_values(&[
|
.possible_values(&[
|
||||||
"auto", "full", "plain", "changes", "header", "grid", "numbers",
|
"auto", "full", "plain", "changes", "header", "grid", "numbers",
|
||||||
])
|
])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
.help("Additional info to display along with content"),
|
.help("Comma-separated list of style elements to display")
|
||||||
|
.long_help(
|
||||||
|
"Configure which elements (line numbers, file headers, grid \
|
||||||
|
borders, Git modifications, ..) to display in addition to the \
|
||||||
|
file contents. The argument is a comma-separated list of \
|
||||||
|
components to display (e.g. 'numbers,changes,grid') or a \
|
||||||
|
pre-defined style ('full')",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("color")
|
Arg::with_name("color")
|
||||||
.long("color")
|
.long("color")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
.possible_values(&["auto", "never", "always"])
|
.possible_values(&["auto", "never", "always"])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
.help("When to use colors"),
|
.help("When to use colors"),
|
||||||
@ -82,14 +105,17 @@ impl App {
|
|||||||
Arg::with_name("paging")
|
Arg::with_name("paging")
|
||||||
.long("paging")
|
.long("paging")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
.possible_values(&["auto", "never", "always"])
|
.possible_values(&["auto", "never", "always"])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
.help("When to use the pager"),
|
.help("When to use the pager")
|
||||||
|
.long_help("Specify when to use the pager (less)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("wrap")
|
Arg::with_name("wrap")
|
||||||
.long("wrap")
|
.long("wrap")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
|
.value_name("mode")
|
||||||
.possible_values(&["character", "never"])
|
.possible_values(&["character", "never"])
|
||||||
.default_value("character")
|
.default_value("character")
|
||||||
.help("When to wrap text"),
|
.help("When to wrap text"),
|
||||||
@ -97,30 +123,46 @@ impl App {
|
|||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("list-languages")
|
Arg::with_name("list-languages")
|
||||||
.long("list-languages")
|
.long("list-languages")
|
||||||
.help("Displays supported languages"),
|
.help("Displays supported languages")
|
||||||
|
.long_help("Display a list of supported languages"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("theme")
|
Arg::with_name("theme")
|
||||||
.long("theme")
|
.long("theme")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.help("Set the theme for highlighting"),
|
.help("Set the theme for highlighting")
|
||||||
|
.long_help(
|
||||||
|
"Set the theme for syntax highlighting. Use '--list-themes' to \
|
||||||
|
see all available themes",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("list-themes")
|
Arg::with_name("list-themes")
|
||||||
.long("list-themes")
|
.long("list-themes")
|
||||||
.help("Displays supported themes"),
|
.help("Displays supported themes")
|
||||||
|
.help("Display a list of supported themes for syntax highlighting"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("number")
|
Arg::with_name("number")
|
||||||
.long("number")
|
.long("number")
|
||||||
.short("n")
|
.short("n")
|
||||||
.conflicts_with("style")
|
.conflicts_with("style")
|
||||||
.help("Alias for '--style=numbers'"),
|
.help("Show line numbers (alias for '--style=numbers')")
|
||||||
|
.long_help(
|
||||||
|
"Show line numbers (no other decorations). This is an alias for \
|
||||||
|
'--style=numbers'",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("unbuffered")
|
Arg::with_name("unbuffered")
|
||||||
.short("u")
|
.short("u")
|
||||||
.help("(ignored)"),
|
.help("(ignored)")
|
||||||
|
// TODO: use '.hidden_short_help(true)' when the next clap version is released
|
||||||
|
.long_help(
|
||||||
|
"This option exists for POSIX-compliance reasons ('u' is for \
|
||||||
|
'unbuffered'). The output is always unbuffered - this option \
|
||||||
|
it simply ignored.",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("cache")
|
SubCommand::with_name("cache")
|
||||||
@ -130,7 +172,10 @@ impl App {
|
|||||||
.long("init")
|
.long("init")
|
||||||
.short("i")
|
.short("i")
|
||||||
.help("Initialize the syntax/theme cache")
|
.help("Initialize the syntax/theme cache")
|
||||||
.long_help("Initialize the syntax/theme cache by loading from the source directory (default: the configuration directory)"),
|
.long_help(
|
||||||
|
"Initialize the syntax/theme cache by loading from the \
|
||||||
|
source directory (default: the configuration directory)",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("clear")
|
Arg::with_name("clear")
|
||||||
@ -163,8 +208,10 @@ impl App {
|
|||||||
.requires("init")
|
.requires("init")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("dir")
|
.value_name("dir")
|
||||||
.help("Use a different source to store the cached syntax and theme set"),
|
.help(
|
||||||
)
|
"Use a different source to store the cached syntax and theme set",
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
.help_message("Print this help message.")
|
.help_message("Print this help message.")
|
||||||
.version_message("Show version information.")
|
.version_message("Show version information.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user