Add short option -a for --all

This commit is contained in:
Ajeet D'Souza 2023-05-09 00:51:26 +05:30
parent e05637ded1
commit 153e060043
8 changed files with 18 additions and 9 deletions

View File

@ -7,6 +7,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Added
- Short option `-a` for `zoxide query --all`.
## [0.9.1] - 2023-05-07 ## [0.9.1] - 2023-05-07
### Added ### Added

View File

@ -118,7 +118,8 @@ _arguments "${_arguments_options[@]}" \
(query) (query)
_arguments "${_arguments_options[@]}" \ _arguments "${_arguments_options[@]}" \
'--exclude=[Exclude the current directory]:path:_files -/' \ '--exclude=[Exclude the current directory]:path:_files -/' \
'--all[Show deleted directories]' \ '-a[Show unavailable directories]' \
'--all[Show unavailable 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]' \
'(-i --interactive)-l[List all matching directories]' \ '(-i --interactive)-l[List all matching directories]' \

View File

@ -100,7 +100,8 @@ Register-ArgumentCompleter -Native -CommandName 'zoxide' -ScriptBlock {
} }
'zoxide;query' { 'zoxide;query' {
[CompletionResult]::new('--exclude', 'exclude', [CompletionResultType]::ParameterName, 'Exclude the current directory') [CompletionResult]::new('--exclude', 'exclude', [CompletionResultType]::ParameterName, 'Exclude the current directory')
[CompletionResult]::new('--all', 'all', [CompletionResultType]::ParameterName, 'Show deleted directories') [CompletionResult]::new('-a', 'a', [CompletionResultType]::ParameterName, 'Show unavailable directories')
[CompletionResult]::new('--all', 'all', [CompletionResultType]::ParameterName, 'Show unavailable directories')
[CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Use interactive selection') [CompletionResult]::new('-i', 'i', [CompletionResultType]::ParameterName, 'Use interactive selection')
[CompletionResult]::new('--interactive', 'interactive', [CompletionResultType]::ParameterName, 'Use interactive selection') [CompletionResult]::new('--interactive', 'interactive', [CompletionResultType]::ParameterName, 'Use interactive selection')
[CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'List all matching directories') [CompletionResult]::new('-l', 'l', [CompletionResultType]::ParameterName, 'List all matching directories')

View File

@ -187,7 +187,7 @@ _zoxide() {
return 0 return 0
;; ;;
zoxide__query) zoxide__query)
opts="-i -l -s -h -V --all --interactive --list --score --exclude --help --version [KEYWORDS]..." opts="-a -i -l -s -h -V --all --interactive --list --score --exclude --help --version [KEYWORDS]..."
if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )
return 0 return 0

View File

@ -88,7 +88,8 @@ set edit:completion:arg-completer[zoxide] = {|@words|
} }
&'zoxide;query'= { &'zoxide;query'= {
cand --exclude 'Exclude the current directory' cand --exclude 'Exclude the current directory'
cand --all 'Show deleted directories' cand -a 'Show unavailable directories'
cand --all 'Show unavailable directories'
cand -i 'Use interactive selection' cand -i 'Use interactive selection'
cand --interactive 'Use interactive selection' cand --interactive 'Use interactive selection'
cand -l 'List all matching directories' cand -l 'List all matching directories'

View File

@ -32,7 +32,7 @@ complete -c zoxide -n "__fish_seen_subcommand_from init" -l no-cmd -d 'Prevents
complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Print help' complete -c zoxide -n "__fish_seen_subcommand_from init" -s h -l help -d 'Print help'
complete -c zoxide -n "__fish_seen_subcommand_from init" -s V -l version -d 'Print version' complete -c zoxide -n "__fish_seen_subcommand_from init" -s V -l version -d 'Print version'
complete -c zoxide -n "__fish_seen_subcommand_from query" -l exclude -d 'Exclude the current directory' -r -f -a "(__fish_complete_directories)" complete -c zoxide -n "__fish_seen_subcommand_from query" -l exclude -d 'Exclude the current directory' -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 a -l all -d 'Show unavailable 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'

View File

@ -205,8 +205,8 @@ const completion: Fig.Spec = {
}, },
}, },
{ {
name: "--all", name: ["-a", "--all"],
description: "Show deleted directories", description: "Show unavailable directories",
}, },
{ {
name: ["-i", "--interactive"], name: ["-i", "--interactive"],

View File

@ -150,8 +150,8 @@ pub enum InitShell {
pub struct Query { pub struct Query {
pub keywords: Vec<String>, pub keywords: Vec<String>,
/// Show deleted directories /// Show unavailable directories
#[clap(long)] #[clap(long, short)]
pub all: bool, pub all: bool,
/// Use interactive selection /// Use interactive selection