Add value hints for completions (#216)
This commit is contained in:
parent
b4a3c46122
commit
b8bb6f0f85
|
@ -32,7 +32,7 @@ _zoxide() {
|
||||||
_arguments "${_arguments_options[@]}" \
|
_arguments "${_arguments_options[@]}" \
|
||||||
'-h[Prints help information]' \
|
'-h[Prints help information]' \
|
||||||
'--help[Prints help information]' \
|
'--help[Prints help information]' \
|
||||||
':path:' \
|
':path:_files -/' \
|
||||||
&& ret=0
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(import)
|
(import)
|
||||||
|
@ -41,7 +41,7 @@ _arguments "${_arguments_options[@]}" \
|
||||||
'--merge[Merge into existing database]' \
|
'--merge[Merge into existing database]' \
|
||||||
'-h[Prints help information]' \
|
'-h[Prints help information]' \
|
||||||
'--help[Prints help information]' \
|
'--help[Prints help information]' \
|
||||||
':path:' \
|
':path:_files' \
|
||||||
&& ret=0
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
(init)
|
(init)
|
||||||
|
@ -56,7 +56,7 @@ _arguments "${_arguments_options[@]}" \
|
||||||
;;
|
;;
|
||||||
(query)
|
(query)
|
||||||
_arguments "${_arguments_options[@]}" \
|
_arguments "${_arguments_options[@]}" \
|
||||||
'--exclude=[Exclude a path from results]' \
|
'--exclude=[Exclude a path from results]: :_files -/' \
|
||||||
'--all[Show deleted directories]' \
|
'--all[Show deleted directories]' \
|
||||||
'(-l --list)-i[Use interactive selection]' \
|
'(-l --list)-i[Use interactive selection]' \
|
||||||
'(-l --list)--interactive[Use interactive selection]' \
|
'(-l --list)--interactive[Use interactive selection]' \
|
||||||
|
@ -75,7 +75,7 @@ _arguments "${_arguments_options[@]}" \
|
||||||
'()*--interactive=[]' \
|
'()*--interactive=[]' \
|
||||||
'-h[Prints help information]' \
|
'-h[Prints help information]' \
|
||||||
'--help[Prints help information]' \
|
'--help[Prints help information]' \
|
||||||
'::path:' \
|
'::path:_files -/' \
|
||||||
&& ret=0
|
&& ret=0
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
|
@ -5,9 +5,9 @@ complete -c zoxide -n "__fish_use_subcommand" -f -a "import" -d 'Import entries
|
||||||
complete -c zoxide -n "__fish_use_subcommand" -f -a "init" -d 'Generate shell configuration'
|
complete -c zoxide -n "__fish_use_subcommand" -f -a "init" -d 'Generate shell configuration'
|
||||||
complete -c zoxide -n "__fish_use_subcommand" -f -a "query" -d 'Search for a directory in the database'
|
complete -c zoxide -n "__fish_use_subcommand" -f -a "query" -d 'Search for a directory in the database'
|
||||||
complete -c zoxide -n "__fish_use_subcommand" -f -a "remove" -d 'Remove a directory from the database'
|
complete -c zoxide -n "__fish_use_subcommand" -f -a "remove" -d 'Remove a directory from the database'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from add" -r
|
complete -c zoxide -n "__fish_seen_subcommand_from add" -r -f -a "(__fish_complete_directories)"
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from add" -s h -l help -d 'Prints help information'
|
complete -c zoxide -n "__fish_seen_subcommand_from add" -s h -l help -d 'Prints help information'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from import" -r
|
complete -c zoxide -n "__fish_seen_subcommand_from import" -r -F
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "autojump z"
|
complete -c zoxide -n "__fish_seen_subcommand_from import" -l from -d 'Application to import from' -r -f -a "autojump z"
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from import" -l merge -d 'Merge into existing database'
|
complete -c zoxide -n "__fish_seen_subcommand_from import" -l merge -d 'Merge into existing database'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from import" -s h -l help -d 'Prints help information'
|
complete -c zoxide -n "__fish_seen_subcommand_from import" -s h -l help -d 'Prints help information'
|
||||||
|
@ -17,12 +17,12 @@ complete -c zoxide -n "__fish_seen_subcommand_from init" -l hook -d 'Chooses eve
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from init" -l no-aliases -d 'Prevents zoxide from defining any commands'
|
complete -c zoxide -n "__fish_seen_subcommand_from init" -l no-aliases -d 'Prevents zoxide from defining any commands'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Prints help information'
|
complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Prints help information'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -r
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -r
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -l exclude -d 'Exclude a path from results' -r
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -l exclude -d 'Exclude a path from results' -r -f -a "(__fish_complete_directories)"
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -l all -d 'Show deleted directories'
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -l all -d 'Show deleted directories'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -s i -l interactive -d 'Use interactive selection'
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -s i -l interactive -d 'Use interactive selection'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -s l -l list -d 'List all matching directories'
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -s l -l list -d 'List all matching directories'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -s s -l score -d 'Print score with results'
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -s s -l score -d 'Print score with results'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from query" -s h -l help -d 'Prints help information'
|
complete -c zoxide -n "__fish_seen_subcommand_from query" -s h -l help -d 'Prints help information'
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from remove" -s i -l interactive -r
|
complete -c zoxide -n "__fish_seen_subcommand_from remove" -s i -l interactive -r
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from remove" -r
|
complete -c zoxide -n "__fish_seen_subcommand_from remove" -r -f -a "(__fish_complete_directories)"
|
||||||
complete -c zoxide -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Prints help information'
|
complete -c zoxide -n "__fish_seen_subcommand_from remove" -s h -l help -d 'Prints help information'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use clap::{AppSettings, ArgEnum, Clap};
|
use clap::{AppSettings, ArgEnum, Clap, ValueHint};
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
@ -33,12 +33,14 @@ pub enum App {
|
||||||
/// Add a new directory or increment its rank
|
/// Add a new directory or increment its rank
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
pub struct Add {
|
pub struct Add {
|
||||||
|
#[clap(value_hint = ValueHint::DirPath)]
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Import entries from another application
|
/// Import entries from another application
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
pub struct Import {
|
pub struct Import {
|
||||||
|
#[clap(value_hint = ValueHint::FilePath)]
|
||||||
pub path: PathBuf,
|
pub path: PathBuf,
|
||||||
|
|
||||||
/// Application to import from
|
/// Application to import from
|
||||||
|
@ -116,7 +118,7 @@ pub struct Query {
|
||||||
pub score: bool,
|
pub score: bool,
|
||||||
|
|
||||||
/// Exclude a path from results
|
/// Exclude a path from results
|
||||||
#[clap(long, value_name = "path")]
|
#[clap(long, value_hint = ValueHint::DirPath, value_name = "path")]
|
||||||
pub exclude: Option<String>,
|
pub exclude: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,6 +128,10 @@ pub struct Remove {
|
||||||
// Use interactive selection
|
// Use interactive selection
|
||||||
#[clap(conflicts_with = "path", long, short, value_name = "keywords")]
|
#[clap(conflicts_with = "path", long, short, value_name = "keywords")]
|
||||||
pub interactive: Option<Vec<String>>,
|
pub interactive: Option<Vec<String>>,
|
||||||
#[clap(conflicts_with = "interactive", required_unless_present = "interactive")]
|
#[clap(
|
||||||
|
conflicts_with = "interactive",
|
||||||
|
required_unless_present = "interactive",
|
||||||
|
value_hint = ValueHint::DirPath
|
||||||
|
)]
|
||||||
pub path: Option<String>,
|
pub path: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue