Remove long_help in favor of help

Maintaining two help strings in order to have a shorter help message
doesn't seem worth it.

type: documentation
This commit is contained in:
Casey Rodarmor 2020-03-06 23:25:15 -08:00
parent 4fffa777b4
commit cba238470d
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
3 changed files with 53 additions and 73 deletions

View File

@ -5,11 +5,10 @@ pub(crate) struct Options {
#[structopt( #[structopt(
long = "unstable", long = "unstable",
short = "u", short = "u",
help = "Enable unstable features.", help = "Enable unstable features. To avoid premature stabilization and excessive version \
long_help = "Enable unstable features. To avoid premature stabilization and excessive version \ churn, unstable features are unavailable unless this flag is set. Unstable features \
churn, unstable features are unavailable unless this flag is set. Unstable \ are not bound by semantic versioning stability guarantees, and may be changed or \
features are not bound by semantic versioning stability guarantees, and may be \ removed at any time."
changed or removed at any time."
)] )]
unstable: bool, unstable: bool,
#[structopt( #[structopt(
@ -17,11 +16,10 @@ pub(crate) struct Options {
default_value = use_color::AUTO, default_value = use_color::AUTO,
set = ArgSettings::CaseInsensitive, set = ArgSettings::CaseInsensitive,
possible_values = use_color::VALUES, possible_values = use_color::VALUES,
help = "Print colorful output.", help = "Print colorful output. When `auto`, the default, colored output is only enabled \
long_help = "Print colorful output. When `auto`, the default, colored output is only enabled \ if imdl detects that it is connected to a terminal, the `NO_COLOR` environment \
if imdl detects that it is connected to a terminal, the `NO_COLOR` environment \ variable is not set, and the `TERM` environment variable is not set with a \
variable is not set, and the `TERM` environment variable is not set with a \ value of `dumb`.",
value of `dumb`.",
)] )]
pub(crate) use_color: UseColor, pub(crate) use_color: UseColor,
} }

View File

@ -11,54 +11,48 @@ pub(crate) struct Create {
name = "ANNOUNCE", name = "ANNOUNCE",
long = "announce", long = "announce",
required(true), required(true),
help = "Use `ANNOUNCE` as the primary tracker announce URL.", help = "Use `ANNOUNCE` as the primary tracker announce URL. To supply multiple announce URLs, \
long_help = "Use `ANNOUNCE` as the primary tracker announce URL. To supply multiple announce \ also use `--announce-tier`."
URLs, also use `--announce-tier`."
)] )]
announce: Url, announce: Url,
#[structopt( #[structopt(
name = "ALLOW", name = "ALLOW",
long = "allow", long = "allow",
help = "Use `ANNOUNCE` as the primary tracker announce URL.", help = "Use `ANNOUNCE` as the primary tracker announce URL. To supply multiple announce URLs, \
long_help = "Use `ANNOUNCE` as the primary tracker announce URL. To supply multiple announce \ also use `--announce-tier`."
URLs, also use `--announce-tier`."
)] )]
allowed_lints: Vec<Lint>, allowed_lints: Vec<Lint>,
#[structopt( #[structopt(
long = "announce-tier", long = "announce-tier",
name = "ANNOUNCE-TIER", name = "ANNOUNCE-TIER",
help = "Add `ANNOUNCE-TIER` to list of tracker announce tiers.", help = "Add `ANNOUNCE-TIER` to list of tracker announce tiers. Each instance adds a new \
long_help = "Add `ANNOUNCE-TIER` to list of tracker announce tiers. Each instance adds a new \ tier. To add multiple trackers to a given tier, separate their announce URLs \
tier. To add multiple trackers to a given tier, separate their announce URLs \ with commas:\n\
with commas:\n\ \n\
\n\ `--announce-tier udp://example.com:80/announce,https://example.net:443/announce`
`--announce-tier udp://example.com:80/announce,https://example.net:443/announce` \n\
\n\ Announce tiers are stored in the `announce-list` key of the top-level metainfo \
Announce tiers are stored in the `announce-list` key of the top-level metainfo \ dictionary as a list of lists of strings, as defined by BEP 12: Multitracker \
dictionary as a list of lists of strings, as defined by BEP 12: Multitracker \ Metadata Extension.
Metadata Extension. \n\
\n\ Note: Many BitTorrent clients do not implement the behavior described in BEP \
Note: Many BitTorrent clients do not implement the behavior described in BEP \ 12. See the discussion here for more details: \
12. See the discussion here for more details: \ https://github.com/bittorrent/bittorrent.org/issues/82"
https://github.com/bittorrent/bittorrent.org/issues/82"
)] )]
announce_tiers: Vec<String>, announce_tiers: Vec<String>,
#[structopt( #[structopt(
name = "COMMENT", name = "COMMENT",
long = "comment", long = "comment",
help = "Include `COMMENT` in generated `.torrent` file.", help = "Include `COMMENT` in generated `.torrent` file. Stored under `comment` key of \
long_help = "Include `COMMENT` in generated `.torrent` file. Stored under `comment` key of \ top-level metainfo dictionary."
top-level metainfo dictionary."
)] )]
comment: Option<String>, comment: Option<String>,
#[structopt( #[structopt(
name = "NODE", name = "NODE",
long = "dht-node", long = "dht-node",
help = "Add DHT bootstrap node `NODE` to torrent. `NODE` should be in the form `HOST:PORT`.", help = "Add DHT bootstrap node `NODE` to torrent. `NODE` should be in the form `HOST:PORT`, \
long_help = "Add DHT bootstrap node `NODE` to torrent. `NODE` should be in the form \ where `HOST` is a domain name, an IPv4 address, or an IPv6 address surrounded by \
`HOST:PORT`, where `HOST` is a domain name, an IPv4 address, or an IPv6 address \ brackets. May be given more than once to add multiple bootstrap nodes. Examples:
surrounded by brackets. May be given more than once to add multiple bootstrap \
nodes. Examples:
`--dht-node router.example.com:1337` `--dht-node router.example.com:1337`
`--dht-node 203.0.113.0:2290` `--dht-node 203.0.113.0:2290`
`--dht-node [2001:db8:4275:7920:6269:7463:6f69:6e21]:8832`" `--dht-node [2001:db8:4275:7920:6269:7463:6f69:6e21]:8832`"
@ -100,10 +94,9 @@ pub(crate) struct Create {
#[structopt( #[structopt(
name = "INPUT", name = "INPUT",
long = "input", long = "input",
help = "Read torrent contents from `INPUT`.", help = "Read torrent contents from `INPUT`. If `INPUT` is a file, torrent will be a \
long_help = "Read torrent contents from `INPUT`. If `INPUT` is a file, torrent will be a \ single-file torrent, otherwise if `INPUT` is a directory, torrent will be a \
single-file torrent, otherwise if `INPUT` is a directory, torrent will be a \ multi-file torrent.",
multi-file torrent.",
parse(from_os_str) parse(from_os_str)
)] )]
input: PathBuf, input: PathBuf,
@ -111,9 +104,7 @@ pub(crate) struct Create {
name = "MD5SUM", name = "MD5SUM",
long = "md5sum", long = "md5sum",
help = "Include MD5 checksum of each file in the torrent. N.B. MD5 is cryptographically \ help = "Include MD5 checksum of each file in the torrent. N.B. MD5 is cryptographically \
broken and only suitable for safeguarding against accidental corruption.", broken and only suitable for checking for accidental corruption."
long_help = "Include MD5 checksum of each file in the torrent. N.B. MD5 is cryptographically \
broken and only suitable for checking for accidental corruption."
)] )]
md5sum: bool, md5sum: bool,
#[structopt( #[structopt(
@ -137,9 +128,8 @@ pub(crate) struct Create {
#[structopt( #[structopt(
name = "OPEN", name = "OPEN",
long = "open", long = "open",
help = "Open `.torrent` file after creation", help = "Open `.torrent` file after creation. Uses `xdg-open`, `gnome-open`, or `kde-open` on \
long_help = "Open `.torrent` file after creation. Uses `xdg-open`, `gnome-open`, or \ Linux; `open` on macOS; and `cmd /C start on Windows"
`kde-open` on Linux; `open` on macOS; and `cmd /C start on Windows"
)] )]
open: bool, open: bool,
#[structopt( #[structopt(
@ -153,28 +143,24 @@ pub(crate) struct Create {
#[structopt( #[structopt(
name = "PIECE-LENGTH", name = "PIECE-LENGTH",
long = "piece-length", long = "piece-length",
help = "Set piece length to `PIECE-LENGTH` bytes.", help = "Set piece length to `PIECE-LENGTH` bytes. Accepts SI units, e.g. kib, mib, and gib."
long_help = "Set piece length to `PIECE-LENGTH` bytes. Accepts SI units, e.g. kib, mib, and \
gib."
)] )]
piece_length: Option<Bytes>, piece_length: Option<Bytes>,
#[structopt( #[structopt(
name = "PRIVATE", name = "PRIVATE",
long = "private", long = "private",
help = "Set the `private` flag.", help = "Set the `private` flag. Torrent clients that understand the flag and participate in \
long_help = "Set the `private` flag. Torrent clients that understand the flag and participate \ the swarm of a torrent with the flag set will only announce themselves to the \
in the swarm of a torrent with the flag set will only announce themselves to the \ announce URLs included in the torrent, and will not use other peer discovery \
announce URLs included in the torrent, and will not use other peer discovery \ mechanisms, such as the DHT or local peer discovery. See BEP 27: Private Torrents for \
mechanisms, such as the DHT or local peer discovery. See BEP 27: Private \ more information."
Torrents for more information."
)] )]
private: bool, private: bool,
#[structopt( #[structopt(
name = "SOURCE", name = "SOURCE",
long = "source", long = "source",
help = "Include `SOURCE` in generated `.torrent` file.", help = "Include `SOURCE` in generated `.torrent` file. Stored under `info.source` key of \
long_help = "Include `SOURCe` in generated `.torrent` file. Stored under `info.source` key of \ metainfo dictionary."
metainfo dictionary."
)] )]
source: Option<String>, source: Option<String>,
} }

View File

@ -11,31 +11,27 @@ pub(crate) struct Stats {
name = "COUNT", name = "COUNT",
long = "limit", long = "limit",
short = "l", short = "l",
help = "Stop after processing the first `COUNT` torrents.", help = "Stop after processing the first `COUNT` torrents. Useful when processing large \
long_help = "Stop after processing the first `COUNT` torrents. Useful when processing large \ collections of `.torrent` files."
collections of `.torrent` files."
)] )]
limit: Option<u64>, limit: Option<u64>,
#[structopt( #[structopt(
name = "REGEX", name = "REGEX",
long = "extract-pattern", long = "extract-pattern",
short = "e", short = "e",
help = "Extract and display values from key paths that match `REGEX`.", help = "Extract and display values under key paths that match `REGEX`. Subkeys of a \
long_help = "Extract and display values under key paths that match `REGEX`. Subkeys of a \ bencodeded dictionary are delimited by `/`, and values of a bencoded list are \
bencodeded dictionary are delimited by `/`, and values of a bencoded list are \ delmited by `*`. For example, given the following bencoded dictionary `{\"foo\": \
delmited by `*`. For example, given the following bencoded dictionary `{\"foo\": \ [{\"bar\": {\"baz\": 2}}]}`, the value `2`'s key path will be `foo*bar/baz`. The \
[{\"bar\": {\"baz\": 2}}]}`, the value `2`'s key path will be `foo*bar/baz`. The \ value `2` would be displayed if any of `bar`, `foo[*]bar/baz`, or `foo.*baz` were \
value `2` would be displayed if any of `bar`, `foo[*]bar/baz`, or `foo.*baz` \ passed to `--extract-pattern."
were passed to `--extract-pattern."
)] )]
extract_patterns: Vec<Regex>, extract_patterns: Vec<Regex>,
#[structopt( #[structopt(
name = "INPUT", name = "INPUT",
long = "input", long = "input",
short = "i", short = "i",
help = "Search `INPUT` for torrents.", help = "Search `INPUT` for torrents. May be a directory to search or a single torrent file.",
long_help = "Search `INPUT` for torrents. May be a directory to search or a single torrent \
file.",
parse(from_os_str) parse(from_os_str)
)] )]
input: PathBuf, input: PathBuf,