mirror of
https://github.com/denisidoro/navi
synced 2024-11-24 20:43:06 +00:00
ix colors in help message
This commit is contained in:
parent
5a46e48fd6
commit
32a3746174
1 changed files with 36 additions and 18 deletions
|
@ -55,39 +55,39 @@ impl FromStr for Info {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clap)]
|
#[derive(Debug, Clap)]
|
||||||
#[clap(after_help = r#"MORE INFO:
|
#[clap(after_help = "\x1b[0;33mMORE INFO:\x1b[0;0m
|
||||||
Please refer to https://github.com/denisidoro/navi
|
Please refer to \x1b[0;32mhttps://github.com/denisidoro/navi\x1b[0;0m
|
||||||
|
|
||||||
MORE ENVIRONMENT VARIABLES:
|
\x1b[0;33mENVIRONMENT VARIABLES:\x1b[0m
|
||||||
NAVI_CONFIG # path to config file
|
\x1b[0;32mNAVI_CONFIG\x1b[0;0m # path to config file
|
||||||
NAVI_CONFIG_YAML # config file content
|
\x1b[0;32mNAVI_CONFIG_YAML\x1b[0;0m # config file content
|
||||||
|
|
||||||
CONFIG FILE:
|
\x1b[0;33mFEATURE STABILITY:\x1b[0m
|
||||||
Please check the online documentation or run `navi fn welcome` to setup the file
|
\x1b[0;32mexperimental\x1b[0;0m # may be removed or changed at any time
|
||||||
|
\x1b[0;32mdeprecated\x1b[0;0m # may be removed in 3 months after first being deprecated
|
||||||
|
|
||||||
FEATURE STABILITY:
|
\x1b[0;33mCOMMON NAVI COMMANDS:\x1b[0m
|
||||||
experimental # may be removed or changed at any time
|
Run \x1b[0;32mnavi fn welcome\x1b[0;0m to browse the cheatsheet for navi itself
|
||||||
deprecated # may be removed in 3 months after first being deprecated
|
|
||||||
|
|
||||||
EXAMPLES:
|
\x1b[0;33mEXAMPLES:\x1b[0m
|
||||||
navi # default behavior
|
navi # default behavior
|
||||||
navi fn welcome # show cheatsheets for navi itself
|
navi fn welcome # show cheatsheets for navi itself
|
||||||
navi --print # doesn't execute the snippet
|
navi --print # doesn't execute the snippet
|
||||||
navi --tldr docker # search for docker cheatsheets using tldr
|
navi --tldr docker # search for docker cheatsheets using tldr
|
||||||
navi --cheatsh docker # search for docker cheatsheets using cheatsh
|
navi --cheatsh docker # search for docker cheatsheets using cheatsh
|
||||||
navi --path '/some/dir:/other/dir' # use .cheat files from custom paths
|
navi --path '/some/dir:/other/dir' # use .cheat files from custom paths
|
||||||
navi --query git # filter results by "git"
|
navi --query git # filter results by \"git\"
|
||||||
navi --query 'create db' --best-match # autoselect the snippet that best matches a query
|
navi --query 'create db' --best-match # autoselect the snippet that best matches a query
|
||||||
db=my navi --query 'create db' --best-match # same, but set the value for the <name> variable
|
db=my navi --query 'create db' --best-match # same, but set the value for the <name> variable
|
||||||
navi repo add denisidoro/cheats # import cheats from a git repository
|
navi repo add denisidoro/cheats # import cheats from a git repository
|
||||||
eval "$(navi widget zsh)" # load the zsh widget
|
eval \"$(navi widget zsh)\" # load the zsh widget
|
||||||
navi --finder 'skim' # set skim as finder, instead of fzf
|
navi --finder 'skim' # set skim as finder, instead of fzf
|
||||||
navi --fzf-overrides '--with-nth 1,2' # show only the comment and tag columns
|
navi --fzf-overrides '--with-nth 1,2' # show only the comment and tag columns
|
||||||
navi --fzf-overrides '--no-select-1' # prevent autoselection in case of single line
|
navi --fzf-overrides '--no-select-1' # prevent autoselection in case of single line
|
||||||
navi --fzf-overrides-var '--no-select-1' # same, but for variable selection
|
navi --fzf-overrides-var '--no-select-1' # same, but for variable selection
|
||||||
navi --fzf-overrides '--nth 1,2' # only consider the first two columns for search
|
navi --fzf-overrides '--nth 1,2' # only consider the first two columns for search
|
||||||
navi --fzf-overrides '--no-exact' # use looser search algorithm
|
navi --fzf-overrides '--no-exact' # use looser search algorithm
|
||||||
navi --tag-rules='git,!checkout' # show non-checkout git snippets only"#)]
|
navi --tag-rules='git,!checkout' # show non-checkout git snippets only")]
|
||||||
#[clap(setting = AppSettings::ColorAuto)]
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
#[clap(setting = AppSettings::ColoredHelp)]
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
#[clap(setting = AppSettings::AllowLeadingHyphen)]
|
#[clap(setting = AppSettings::AllowLeadingHyphen)]
|
||||||
|
@ -105,7 +105,7 @@ pub(super) struct ClapConfig {
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub best_match: bool,
|
pub best_match: bool,
|
||||||
|
|
||||||
/// Search for cheatsheets using the tldr-pages repository
|
/// Searches for cheatsheets using the tldr-pages repository
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub tldr: Option<String>,
|
pub tldr: Option<String>,
|
||||||
|
|
||||||
|
@ -113,11 +113,11 @@ pub(super) struct ClapConfig {
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub tag_rules: Option<String>,
|
pub tag_rules: Option<String>,
|
||||||
|
|
||||||
/// Search for cheatsheets using the cheat.sh repository
|
/// Searches for cheatsheets using the cheat.sh repository
|
||||||
#[clap(long)]
|
#[clap(long)]
|
||||||
pub cheatsh: Option<String>,
|
pub cheatsh: Option<String>,
|
||||||
|
|
||||||
/// Query
|
/// Prepopulates the search field
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
pub query: Option<String>,
|
pub query: Option<String>,
|
||||||
|
|
||||||
|
@ -144,8 +144,12 @@ impl ClapConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clap)]
|
#[derive(Debug, Clap)]
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
/// [Experimental] Performs ad-hoc, internal functions provided by navi
|
/// [Experimental] Calls internal functions
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
Fn {
|
Fn {
|
||||||
/// Function name (example: "url::open")
|
/// Function name (example: "url::open")
|
||||||
#[clap(possible_values = FUNC_POSSIBLE_VALUES, case_insensitive = true)]
|
#[clap(possible_values = FUNC_POSSIBLE_VALUES, case_insensitive = true)]
|
||||||
|
@ -154,18 +158,24 @@ pub enum Command {
|
||||||
args: Vec<String>,
|
args: Vec<String>,
|
||||||
},
|
},
|
||||||
/// Manages cheatsheet repositories
|
/// Manages cheatsheet repositories
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
Repo {
|
Repo {
|
||||||
#[clap(subcommand)]
|
#[clap(subcommand)]
|
||||||
cmd: RepoCommand,
|
cmd: RepoCommand,
|
||||||
},
|
},
|
||||||
/// Used for fzf's preview window when selecting snippets
|
/// Used for fzf's preview window when selecting snippets
|
||||||
#[clap(setting = AppSettings::Hidden)]
|
#[clap(setting = AppSettings::Hidden)]
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
Preview {
|
Preview {
|
||||||
/// Selection line
|
/// Selection line
|
||||||
line: String,
|
line: String,
|
||||||
},
|
},
|
||||||
/// Used for fzf's preview window when selecting variable suggestions
|
/// Used for fzf's preview window when selecting variable suggestions
|
||||||
#[clap(setting = AppSettings::Hidden)]
|
#[clap(setting = AppSettings::Hidden)]
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
PreviewVar {
|
PreviewVar {
|
||||||
/// Selection line
|
/// Selection line
|
||||||
selection: String,
|
selection: String,
|
||||||
|
@ -176,13 +186,19 @@ pub enum Command {
|
||||||
},
|
},
|
||||||
/// Used for fzf's preview window when selecting variable suggestions
|
/// Used for fzf's preview window when selecting variable suggestions
|
||||||
#[clap(setting = AppSettings::Hidden)]
|
#[clap(setting = AppSettings::Hidden)]
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
PreviewVarStdin,
|
PreviewVarStdin,
|
||||||
/// Outputs shell widget source code
|
/// Outputs shell widget source code
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
Widget {
|
Widget {
|
||||||
#[clap(possible_values = WIDGET_POSSIBLE_VALUES, case_insensitive = true, default_value = "bash")]
|
#[clap(possible_values = WIDGET_POSSIBLE_VALUES, case_insensitive = true, default_value = "bash")]
|
||||||
shell: Shell,
|
shell: Shell,
|
||||||
},
|
},
|
||||||
/// Shows info
|
/// Shows info
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
Info {
|
Info {
|
||||||
#[clap(possible_values = INFO_POSSIBLE_VALUES, case_insensitive = true)]
|
#[clap(possible_values = INFO_POSSIBLE_VALUES, case_insensitive = true)]
|
||||||
info: Info,
|
info: Info,
|
||||||
|
@ -190,6 +206,8 @@ pub enum Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clap)]
|
#[derive(Debug, Clap)]
|
||||||
|
#[clap(setting = AppSettings::ColorAuto)]
|
||||||
|
#[clap(setting = AppSettings::ColoredHelp)]
|
||||||
pub enum RepoCommand {
|
pub enum RepoCommand {
|
||||||
/// Imports cheatsheets from a repo
|
/// Imports cheatsheets from a repo
|
||||||
Add {
|
Add {
|
||||||
|
|
Loading…
Reference in a new issue