Skip to content

Commit

Permalink
Clap: Set UnifiedHelpMessage and DeriveDisplayOrder options
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrgn committed Oct 16, 2021
1 parent e05eae7 commit 335d8d0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
33 changes: 15 additions & 18 deletions docs/src/usage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ Danilo Bargen <mail@dbrgn.ch>
A fast TLDR client

USAGE:
tldr [FLAGS] [OPTIONS] [command]...
tldr [OPTIONS] [command]...

ARGS:
<command>... The command to show (e.g. `tar` or `git log`)

FLAGS:
-c, --clear-cache Clear the local cache
--config-path Show config file path
-h, --help Prints help information
-l, --list List all commands in the cache
-m, --markdown Display the raw markdown instead of rendering it
-p, --pager Use a pager to page output
-q, --quiet Suppress informational messages
--seed-config Create a basic config
--show-paths Show file and directory paths used by tealdeer
-u, --update Update the local cache
-v, --version Prints the version

OPTIONS:
--color <color> Control whether to use color [always, auto, never]
-L, --language <language> Override the language
-o, --os <os> Override the operating system [linux, macos, sunos, windows]
-l, --list List all commands in the cache
-f, --render <render> Render a specific markdown file

-o, --os <os> Override the operating system [linux, macos, sunos, windows]
-L, --language <language> Override the language
-u, --update Update the local cache
-c, --clear-cache Clear the local cache
-p, --pager Use a pager to page output
-q, --quiet Suppress informational messages
-m, --markdown Display the raw markdown instead of rendering it
--show-paths Show file and directory paths used by tealdeer
--config-path Show config file path
--seed-config Create a basic config
--color <color> Control whether to use color [always, auto, never]
-v, --version Prints the version
-h, --help Prints help information
10 changes: 6 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const PAGER_COMMAND: &str = "less -R";
#[clap(about = "A fast TLDR client", author, version)]
#[clap(setting = AppSettings::ArgRequiredElseHelp)]
#[clap(setting = AppSettings::HelpRequired)]
#[clap(setting = AppSettings::DeriveDisplayOrder)]
#[clap(setting = AppSettings::UnifiedHelpMessage)]
struct Args {
/// The command to show (e.g. `tar` or `git log`)
#[clap(min_values = 1)]
Expand Down Expand Up @@ -88,14 +90,14 @@ struct Args {
#[clap(short = 'p', long = "pager", requires = "command")]
pager: bool,

/// Suppress informational messages
#[clap(short = 'q', long = "quiet")]
quiet: bool,

/// Display the raw markdown instead of rendering it
#[clap(short = 'm', long = "markdown", requires = "command")]
markdown: bool,

/// Suppress informational messages
#[clap(short = 'q', long = "quiet")]
quiet: bool,

/// Show file and directory paths used by tealdeer
#[clap(long = "show-paths")]
show_paths: bool,
Expand Down

0 comments on commit 335d8d0

Please sign in to comment.