Wrap --help
text to terminal width (#940)
This commit is contained in:
parent
7b58ec135c
commit
f5689617f4
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -74,6 +74,7 @@ dependencies = [
|
|||||||
"atty",
|
"atty",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"strsim",
|
"strsim",
|
||||||
|
"term_size",
|
||||||
"textwrap",
|
"textwrap",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"vec_map",
|
"vec_map",
|
||||||
@ -558,6 +559,16 @@ dependencies = [
|
|||||||
"tempfile",
|
"tempfile",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "term_size"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e4129646ca0ed8f45d09b929036bafad5377103edd06e50bf574b353d2b08d9"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"winapi",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "termcolor"
|
||||||
version = "1.1.2"
|
version = "1.1.2"
|
||||||
@ -573,6 +584,7 @@ version = "0.11.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"term_size",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ members = [".", "bin/ref-type"]
|
|||||||
ansi_term = "0.12.0"
|
ansi_term = "0.12.0"
|
||||||
atty = "0.2.0"
|
atty = "0.2.0"
|
||||||
camino = "1.0.4"
|
camino = "1.0.4"
|
||||||
clap = "2.33.0"
|
|
||||||
derivative = "2.0.0"
|
derivative = "2.0.0"
|
||||||
dotenv = "0.15.0"
|
dotenv = "0.15.0"
|
||||||
edit-distance = "2.0.0"
|
edit-distance = "2.0.0"
|
||||||
@ -36,6 +35,10 @@ tempfile = "3.0.0"
|
|||||||
typed-arena = "2.0.1"
|
typed-arena = "2.0.1"
|
||||||
unicode-width = "0.1.0"
|
unicode-width = "0.1.0"
|
||||||
|
|
||||||
|
[dependencies.clap]
|
||||||
|
version = "2.33.0"
|
||||||
|
features = ["wrap_help"]
|
||||||
|
|
||||||
[dependencies.ctrlc]
|
[dependencies.ctrlc]
|
||||||
version = "3.1.1"
|
version = "3.1.1"
|
||||||
features = ["termination"]
|
features = ["termination"]
|
||||||
|
@ -576,17 +576,18 @@ USAGE:
|
|||||||
|
|
||||||
FLAGS:
|
FLAGS:
|
||||||
--changelog Print changelog
|
--changelog Print changelog
|
||||||
--choose Select one or more recipes to run using a binary. If `--chooser` is \
|
--choose Select one or more recipes to run using a binary.
|
||||||
not passed the chooser
|
If `--chooser` is not passed the chooser defaults
|
||||||
defaults to the value of $JUST_CHOOSER, falling back to `fzf`
|
to the value of $JUST_CHOOSER, falling back to
|
||||||
|
`fzf`
|
||||||
--clear-shell-args Clear shell arguments
|
--clear-shell-args Clear shell arguments
|
||||||
--dry-run Print what just would do without doing it
|
--dry-run Print what just would do without doing it
|
||||||
--dump Print entire justfile
|
--dump Print entire justfile
|
||||||
-e, --edit Edit justfile with editor given by $VISUAL or $EDITOR, falling back \
|
-e, --edit Edit justfile with editor given by $VISUAL or
|
||||||
to `vim`
|
$EDITOR, falling back to `vim`
|
||||||
--evaluate Evaluate and print all variables. If a variable name is given as an \
|
--evaluate Evaluate and print all variables. If a variable
|
||||||
argument, only print
|
name is given as an argument, only print that
|
||||||
that variable's value.
|
variable's value.
|
||||||
--fmt Format and overwrite justfile
|
--fmt Format and overwrite justfile
|
||||||
--highlight Highlight echoed recipe lines in bold
|
--highlight Highlight echoed recipe lines in bold
|
||||||
--init Initialize new justfile in project root
|
--init Initialize new justfile in project root
|
||||||
@ -594,8 +595,8 @@ FLAGS:
|
|||||||
--no-dotenv Don't load `.env` file
|
--no-dotenv Don't load `.env` file
|
||||||
--no-highlight Don't highlight echoed recipe lines in bold
|
--no-highlight Don't highlight echoed recipe lines in bold
|
||||||
-q, --quiet Suppress all output
|
-q, --quiet Suppress all output
|
||||||
--shell-command Invoke <COMMAND> with the shell used to run recipe lines and \
|
--shell-command Invoke <COMMAND> with the shell used to run recipe
|
||||||
backticks
|
lines and backticks
|
||||||
--summary List names of available recipes
|
--summary List names of available recipes
|
||||||
-u, --unsorted Return list and summary entries in source order
|
-u, --unsorted Return list and summary entries in source order
|
||||||
--unstable Enable unstable features
|
--unstable Enable unstable features
|
||||||
@ -603,34 +604,46 @@ FLAGS:
|
|||||||
-v, --verbose Use verbose output
|
-v, --verbose Use verbose output
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
--chooser <CHOOSER> Override binary invoked by `--choose`
|
--chooser <CHOOSER>
|
||||||
|
Override binary invoked by `--choose`
|
||||||
|
|
||||||
--color <COLOR>
|
--color <COLOR>
|
||||||
Print colorful output [default: auto] [possible values: auto, always, never]
|
Print colorful output [default: auto] [possible values: auto,
|
||||||
|
always, never]
|
||||||
-c, --command <COMMAND>
|
-c, --command <COMMAND>
|
||||||
Run an arbitrary command with the working directory, `.env`, overrides, and exports set
|
Run an arbitrary command with the working directory, `.env`,
|
||||||
|
overrides, and exports set
|
||||||
--completions <SHELL>
|
--completions <SHELL>
|
||||||
Print shell completion script for <SHELL> [possible values: zsh, bash, fish, \
|
Print shell completion script for <SHELL> [possible values: zsh,
|
||||||
powershell, elvish]
|
bash, fish, powershell, elvish]
|
||||||
|
|
||||||
-f, --justfile <JUSTFILE> Use <JUSTFILE> as justfile
|
-f, --justfile <JUSTFILE> Use <JUSTFILE> as justfile
|
||||||
--list-heading <TEXT> Print <TEXT> before list
|
--list-heading <TEXT> Print <TEXT> before list
|
||||||
--list-prefix <TEXT> Print <TEXT> before each list item
|
--list-prefix <TEXT>
|
||||||
--set <VARIABLE> <VALUE> Override <VARIABLE> with <VALUE>
|
Print <TEXT> before each list item
|
||||||
--shell <SHELL> Invoke <SHELL> to run recipes [default: sh]
|
|
||||||
--shell-arg <SHELL-ARG>... Invoke shell with <SHELL-ARG> as an argument \
|
|
||||||
[default: -cu]
|
|
||||||
-s, --show <RECIPE> Show information about <RECIPE>
|
|
||||||
-d, --working-directory <WORKING-DIRECTORY>
|
|
||||||
Use <WORKING-DIRECTORY> as working directory. --justfile must also be set
|
|
||||||
|
|
||||||
|
--set <VARIABLE> <VALUE>
|
||||||
|
Override <VARIABLE> with <VALUE>
|
||||||
|
|
||||||
|
--shell <SHELL>
|
||||||
|
Invoke <SHELL> to run recipes [default: sh]
|
||||||
|
|
||||||
|
--shell-arg <SHELL-ARG>...
|
||||||
|
Invoke shell with <SHELL-ARG> as an argument [default: -cu]
|
||||||
|
|
||||||
|
-s, --show <RECIPE>
|
||||||
|
Show information about <RECIPE>
|
||||||
|
|
||||||
|
-d, --working-directory <WORKING-DIRECTORY>
|
||||||
|
Use <WORKING-DIRECTORY> as working directory. --justfile must also
|
||||||
|
be set
|
||||||
|
|
||||||
ARGS:
|
ARGS:
|
||||||
<ARGUMENTS>... Overrides and recipe(s) to run, defaulting to the first recipe in the \
|
<ARGUMENTS>... Overrides and recipe(s) to run, defaulting to the
|
||||||
justfile";
|
first recipe in the justfile";
|
||||||
|
|
||||||
let app = Config::app().setting(AppSettings::ColorNever);
|
let app = Config::app()
|
||||||
|
.setting(AppSettings::ColorNever)
|
||||||
|
.set_term_width(80);
|
||||||
let mut buffer = Vec::new();
|
let mut buffer = Vec::new();
|
||||||
app.write_help(&mut buffer).unwrap();
|
app.write_help(&mut buffer).unwrap();
|
||||||
let help = str::from_utf8(&buffer).unwrap();
|
let help = str::from_utf8(&buffer).unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user