mirror of
https://github.com/Llewellynvdm/zoxide.git
synced 2024-11-25 14:07:35 +00:00
Add value hints for completions (#216)
This commit is contained in:
parent
b4a3c46122
commit
b8bb6f0f85
@ -32,7 +32,7 @@ _zoxide() {
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'-h[Prints help information]' \
|
||||
'--help[Prints help information]' \
|
||||
':path:' \
|
||||
':path:_files -/' \
|
||||
&& ret=0
|
||||
;;
|
||||
(import)
|
||||
@ -41,7 +41,7 @@ _arguments "${_arguments_options[@]}" \
|
||||
'--merge[Merge into existing database]' \
|
||||
'-h[Prints help information]' \
|
||||
'--help[Prints help information]' \
|
||||
':path:' \
|
||||
':path:_files' \
|
||||
&& ret=0
|
||||
;;
|
||||
(init)
|
||||
@ -56,7 +56,7 @@ _arguments "${_arguments_options[@]}" \
|
||||
;;
|
||||
(query)
|
||||
_arguments "${_arguments_options[@]}" \
|
||||
'--exclude=[Exclude a path from results]' \
|
||||
'--exclude=[Exclude a path from results]: :_files -/' \
|
||||
'--all[Show deleted directories]' \
|
||||
'(-l --list)-i[Use interactive selection]' \
|
||||
'(-l --list)--interactive[Use interactive selection]' \
|
||||
@ -75,7 +75,7 @@ _arguments "${_arguments_options[@]}" \
|
||||
'()*--interactive=[]' \
|
||||
'-h[Prints help information]' \
|
||||
'--help[Prints help information]' \
|
||||
'::path:' \
|
||||
'::path:_files -/' \
|
||||
&& ret=0
|
||||
;;
|
||||
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 "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_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 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 merge -d 'Merge into existing database'
|
||||
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" -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" -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" -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 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 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'
|
||||
|
@ -1,4 +1,4 @@
|
||||
use clap::{AppSettings, ArgEnum, Clap};
|
||||
use clap::{AppSettings, ArgEnum, Clap, ValueHint};
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
@ -33,12 +33,14 @@ pub enum App {
|
||||
/// Add a new directory or increment its rank
|
||||
#[derive(Clap, Debug)]
|
||||
pub struct Add {
|
||||
#[clap(value_hint = ValueHint::DirPath)]
|
||||
pub path: PathBuf,
|
||||
}
|
||||
|
||||
/// Import entries from another application
|
||||
#[derive(Clap, Debug)]
|
||||
pub struct Import {
|
||||
#[clap(value_hint = ValueHint::FilePath)]
|
||||
pub path: PathBuf,
|
||||
|
||||
/// Application to import from
|
||||
@ -116,7 +118,7 @@ pub struct Query {
|
||||
pub score: bool,
|
||||
|
||||
/// Exclude a path from results
|
||||
#[clap(long, value_name = "path")]
|
||||
#[clap(long, value_hint = ValueHint::DirPath, value_name = "path")]
|
||||
pub exclude: Option<String>,
|
||||
}
|
||||
|
||||
@ -126,6 +128,10 @@ pub struct Remove {
|
||||
// Use interactive selection
|
||||
#[clap(conflicts_with = "path", long, short, value_name = "keywords")]
|
||||
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>,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user