diff options
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r-- | Completion/Unix/Command/_beep | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_date | 17 | ||||
-rw-r--r-- | Completion/Unix/Command/_git | 132 | ||||
-rw-r--r-- | Completion/Unix/Command/_gphoto2 | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_head | 45 | ||||
-rw-r--r-- | Completion/Unix/Command/_hg | 275 | ||||
-rw-r--r-- | Completion/Unix/Command/_lldb | 55 | ||||
-rw-r--r-- | Completion/Unix/Command/_nm | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_objdump | 8 | ||||
-rw-r--r-- | Completion/Unix/Command/_qemu | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_sed | 8 | ||||
-rw-r--r-- | Completion/Unix/Command/_sh | 17 | ||||
-rw-r--r-- | Completion/Unix/Command/_ssh | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_systemd | 470 | ||||
-rw-r--r-- | Completion/Unix/Command/_tail | 69 | ||||
-rw-r--r-- | Completion/Unix/Command/_tmux | 16 | ||||
-rw-r--r-- | Completion/Unix/Command/_tr | 53 | ||||
-rw-r--r-- | Completion/Unix/Command/_user_admin | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_zfs | 12 | ||||
-rw-r--r-- | Completion/Unix/Command/_zpool | 4 | ||||
-rw-r--r-- | Completion/Unix/Command/_zsh | 23 |
21 files changed, 544 insertions, 674 deletions
diff --git a/Completion/Unix/Command/_beep b/Completion/Unix/Command/_beep index c49c09726..d393bc91e 100644 --- a/Completion/Unix/Command/_beep +++ b/Completion/Unix/Command/_beep @@ -1,4 +1,4 @@ -#compdef _beep +#compdef beep # beep [--verbose | --debug] [-e device | --device device] [-f N] [-l N] # [-r N] [-d N] [-D N] [-s] [-c] diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index e596ac038..ff3bac398 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -1,6 +1,6 @@ #compdef date gdate -local -a args +local -a args alts if _pick_variant gnu="Free Software Foundation" unix --version; then args=( @@ -20,16 +20,27 @@ else solaris*) args=( '-a:adjustment' ) ;; + darwin*|dragonfly*|netbsd*|openbsd*) + args+=( '-r[specify reference time]:seconds since epoch' ) + ;| freebsd*|darwin*|dragonfly*|netbsd*|openbsd*) args=( '-n[only set time on current machine]' '-d:daylight saving time value' '-j[do not try to set date]' - '-r:seconds since epoch' '-t:minutes west of GMT' ) ;| - freebsd*) args+=( '-R[RFC2822 format]' ) ;| + freebsd*) + alts=( + 'seconds:sec:_guard "(0x[0-9a-fA-F]#|[0-9]#)" "seconds since epoch"' + 'files:file:_files' + ) + args+=( + '-r[reference time: file modification or literal time]:reference: _alternative $alts' + '-R[RFC2822 format]' + ) + ;| freebsd*|dragonfly*|darwin*) args+=( '-f:parsing format' '-v:adjustment value' ) ;; diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 40a9fb63b..6e8e9c665 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -656,7 +656,7 @@ _git-commit () { '( --porcelain --dry-run)--short[output dry run in short format]' \ '(--short --dry-run)--porcelain[output dry run in porcelain-ready format]' \ '(--short --porcelain --dry-run -z --null)'{-z,--null}'[separate dry run entry output with NUL]' \ - '--patch[use the interactive patch selection interface to chose which changes to commit]' \ + {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \ '(--reset-author)--author[override the author name used in the commit]:author name' \ '--date=[override the author date used in the commit]:date' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ @@ -1131,6 +1131,7 @@ _git-log () { _git-merge () { local -a merge_options __git_setup_merge_options + local -a git_commit_opts=(--all --not HEAD --not) _arguments -w -S -s \ $merge_options \ @@ -1138,7 +1139,7 @@ _git-merge () { '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ - '*: :__git_commits' + '*: : __git_commits -O expl:git_commit_opts' } (( $+functions[_git-mv] )) || @@ -5004,6 +5005,33 @@ __git_is_in_middle_of_merge () { [[ -f $gitdir/MERGE_HEAD ]] } +(( $+functions[__git_describe_branch] )) || +__git_describe_branch () { + local __commits_in=$1 + local __tag=$2 + local __desc=$3 + shift 3 + + integer maxverbose + if zstyle -s :completion:$curcontext max-verbose maxverbose && + (( ${compstate[nmatches]} <= maxverbose )); then + local __c + local -a __commits + for __c in ${(P)__commits_in}; do + __commits+=("${__c}:${$(_call_program describe git log -1 --oneline $__c)//:/\\:}") + done + _describe -t $__tag $__desc __commits "$@" + else + local expl + _wanted $__tag expl $__desc compadd "$@" -a - $__commits_in + fi +} + +(( $+functions[__git_describe_commit] )) || +__git_describe_commit () { + __git_describe_branch $1 $2 $3 -M 'r:|/=**' "${(@)argv[4,-1]}" +} + # Completion Wrappers (( $+functions[__git_ignore_line] )) || @@ -5216,7 +5244,7 @@ _git_commands () { for cmdtype in aliases $cmdtypes; do local -a ${cmdtype}_d (( $#disp )) && set -A ${cmdtype}_d \ - ${${(Pr.COLUMNS-4.)cmdtype/(#s)(#m)[^:]##:/${(r.len.)MATCH[1,-2]} $sep }%% #} + ${${(r.COLUMNS-4.)${(P)cmdtype}/(#s)(#m)[^:]##:/${(r.len.)MATCH[1,-2]} $sep }%% #} alts+=( "${cmdtype//_/-}:${${cmdtype//_/ }%%(e|)s}:compadd ${(e)disp} -a ${cmdtype}_m" ) done @@ -5313,7 +5341,8 @@ __git_remotes () { __git_ref_specs () { # TODO: This needs to deal with a lot more types of things. if compset -P '*:'; then - __git_heads + # TODO: have the caller supply the correct remote name, restrict to refs/remotes/${that_remote}/* only + __git_remote_branch_names_noprefix else compset -P '+' if compset -S ':*'; then @@ -5487,12 +5516,21 @@ __git_signoff_file () { (( $+functions[__git_stashes] )) || __git_stashes () { local expl + declare -a interleaved declare -a stashes + declare -a descriptions - stashes=(${(f)"$(_call_program stashes git stash list --pretty=format:%gd 2>/dev/null)"}) + interleaved=(${(ps:\0:)"$(_call_program stashes git stash list -z --pretty='format:%gd%x00%s%x00\(%cr\)' 2>/dev/null)"}) __git_command_successful $pipestatus || return 1 + () { + local i j k + for i j k in $interleaved; do + stashes+=($i) + descriptions+=("$i: $j $k") + done + } - _wanted stashes expl stash compadd "$@" -a - stashes + _wanted stashes expl 'stash' compadd -Vx -d descriptions -a - stashes } (( $+functions[__git_svn_revisions] )) || @@ -5531,29 +5569,27 @@ __git_branch_names () { branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/}) __git_command_successful $pipestatus || return 1 - _wanted branch-names expl branch-name compadd "$@" -a - branch_names + __git_describe_commit branch_names branch-names 'branch name' "$@" } (( $+functions[__git_remote_branch_names] )) || __git_remote_branch_names () { - local expl declare -a branch_names branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names + __git_describe_commit branch_names remote-branch-names 'remote branch name' "$@" } (( $+functions[__git_remote_branch_names_noprefix] )) || __git_remote_branch_names_noprefix () { - local expl declare -a heads - branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD}) + branch_names=(${${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/}#*/}:#HEAD}) __git_command_successful $pipestatus || return 1 - _wanted remote-branch-names-noprefix expl 'remote branch name' compadd -M 'r:|/=**' "$@" -a - branch_names + __git_describe_commit branch_names remote-branch-names-noprefix 'remote branch name' "$@" } (( $+functions[__git_commit_objects_prefer_recent] )) || @@ -5593,7 +5629,7 @@ __git_heads () { (( $+functions[__git_heads_local] )) || __git_heads_local () { - local gitdir expl start + local gitdir declare -a heads heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/heads' 2>/dev/null)"}) @@ -5603,19 +5639,19 @@ __git_heads_local () { [[ -f $gitdir/$f ]] && heads+=$f done [[ -f $gitdir/refs/stash ]] && heads+=stash + [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad fi - _wanted heads-local expl "local head" compadd -M 'r:|/=**' "$@" -a - heads + __git_describe_commit heads heads-local "local head" "$@" } (( $+functions[__git_heads_remote] )) || __git_heads_remote () { - local gitdir expl start declare -a heads heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)" refs/remotes' 2>/dev/null)"}) - _wanted heads-remote expl "remote head" compadd -M 'r:|/=**' "$@" -a - heads + __git_describe_commit heads heads-remote "remote head" "$@" } (( $+functions[__git_commit_objects] )) || @@ -5631,7 +5667,7 @@ __git_commit_objects () { commits=(${(f)"$(_call_program commits git --no-pager log -1000 --all --reflog --format='%h:\[%h\]\ %s\ \(%cr\)')"}) __git_command_successful $pipestatus || return 1 - _describe -V -t commits 'commit object name' commits + _describe -Vx -t commits 'commit object name' commits } (( $+functions[__git_recent_commits] )) || @@ -5641,6 +5677,8 @@ __git_recent_commits () { local i j k ret integer distance_from_head local label + local parents + local next_first_parent_ancestral_line_commit zparseopts -D -E O:=argument_array_names # Turn (-O foo:bar) to (foo bar) @@ -5650,10 +5688,10 @@ __git_recent_commits () { # Careful: most %d will expand to the empty string. Quote properly! # NOTE: we could use %D directly, but it's not available in git 1.9.1 at least. - commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)')"}") + commits=("${(f)"$(_call_program commits git --no-pager log $commit_opts -20 --format='%h%n%d%n%s\ \(%cr\)%n%p')"}") __git_command_successful $pipestatus || return 1 - for i j k in "$commits[@]" ; do + for i j k parents in "$commits[@]" ; do # Note: the after-the-colon part must be unique across the entire array; # see workers/34768 if (( $#commit_opts )); then @@ -5662,20 +5700,39 @@ __git_recent_commits () { # description unique (due to workers/34768), which we do by including the # hash. Git always prints enough hash digits to make the output unique.) label="[$i]" - elif (( distance_from_head == 0 )); then - label="[HEAD] " - elif (( distance_from_head == 1 )); then - label="[HEAD^] " - elif (( distance_from_head == 2 )); then - label="[HEAD^^] " - elif (( distance_from_head < 10 )); then - label="[HEAD~$distance_from_head] " + elif (( distance_from_head )) && [[ $i != $next_first_parent_ancestral_line_commit ]]; then + # The first commit (HEAD), and its ancestors along the first-parent line, + # get HEAD~$n labels. + # + # For other commits, we just print the hash. (${parents} does provide enough + # information to compute HEAD~3^2~4 -style labels, though, if somebody cared + # enough to implement that.) + label="[$i]" else - label="[HEAD~$distance_from_head]" + # Compute a first-parent-ancestry commit's label. + if false ; then + elif (( distance_from_head == 0 )); then + label="[HEAD] " + elif (( distance_from_head == 1 )); then + label="[HEAD^] " + elif (( distance_from_head == 2 )); then + label="[HEAD^^] " + elif (( distance_from_head < 10 )); then + label="[HEAD~$distance_from_head] " + else + label="[HEAD~$distance_from_head]" + fi + ## Disabled because _describe renders the output unhelpfuly when this function + ## is called twice during a single completion operation, and list-grouped is + ## in its default setting (enabled). + #descr+=("@~${distance_from_head}":"${label} $k") # CROSSREF: use the same label as below + + # Prepare for the next first-parent-ancestry commit. + (( ++distance_from_head )) + next_first_parent_ancestral_line_commit=${parents%% *} fi # label is now 9 bytes, so the descriptions ($k) will be aligned. - descr+=($i:"${label} $k") - (( ++distance_from_head )) + descr+=($i:"${label} $k") # CROSSREF: use the same label as above j=${${j# \(}%\)} # strip leading ' (' and trailing ')' j=${j/ ->/,} # Convert " -> master, origin/master". @@ -5695,7 +5752,7 @@ __git_recent_commits () { expl=() _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 expl=() - _describe -Vx -t commits 'recent commit object name' descr && ret=0 + _describe -V -t commits 'recent commit object name' descr && ret=0 return $ret } @@ -5753,7 +5810,14 @@ __git_commit_ranges () { if compset -P '*..(.|)'; then expl=( $* ) else - compset -S '..*' || suf=( -S .. -r '.@~ ^:\t\n\-' ) + if ! compset -S '..*'; then + local match mbegin mend + if [[ ${PREFIX} = (#b)((\\|)\^)* ]]; then + compset -p ${#match[1]} + else + suf=( -S .. -r '.@~ ^:\t\n\-' ) + fi + fi expl=( $* $suf ) fi @@ -5814,7 +5878,7 @@ __git_tags () { tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted tags expl tag compadd "$@" -a - tags + _wanted tags expl tag compadd -M 'r:|/=**' "$@" -a - tags } (( $+functions[__git_commit_tags] )) || @@ -5837,7 +5901,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd "$@" -a - tags + _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags } # Reference Argument Types diff --git a/Completion/Unix/Command/_gphoto2 b/Completion/Unix/Command/_gphoto2 index 95d8a49b7..314d83e3a 100644 --- a/Completion/Unix/Command/_gphoto2 +++ b/Completion/Unix/Command/_gphoto2 @@ -32,7 +32,7 @@ _arguments -s \ '--get-all-raw-data[get all raw data from folder]' \ '--get-audio-data[get audio data given in range]:range' \ '--get-all-audio-data[get all audio data from folder]' \ - '--delete-files[delete files given in range]:range' \ + '--delete-file[delete files given in range]:range' \ '--delete-all-files[delete all files in folder]' \ '(-u --upload-file)'{-u,--upload-file}'[upload a file to camera]:file:_files' \ '--capture-preview[capture a quick preview]' \ diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head new file mode 100644 index 000000000..4f956acdc --- /dev/null +++ b/Completion/Unix/Command/_head @@ -0,0 +1,45 @@ +#compdef head + +local curcontext=$curcontext state state_descr line expl opts args ret=1 +typeset -A opt_args + +if _pick_variant gnu=GNU unix --version; then + args=( + '(-n --lines -c --bytes)'{-c+,--bytes=}'[print the first (or with -, all but the last) specified bytes]:number of bytes:->number' + '(-n --lines -c --bytes)'{-n+,--lines=}'[print the first (or with -, all but the last) specified lines]:number of lines:->number' + '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never print headers giving file names]' + '(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always print headers giving file names]' + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) +else + opts=(-A '-*') + args=( '(-c)-n+[display the first specified lines]:number of lines' ) + case $OSTYPE in + (freebsd*|darwin*|dragonfly*|netbsd*) + args+=( '(-n)-c+[display the first specified bytes]:number of bytes' ) + ;; + esac +fi + +_arguments -C -s -S $opts : $args '*:file:_files' && return 0 + +case $state in + (number) + local mlt sign digit + mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' + mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' + sign='sign:sign:((-\:"print all but the last specified bytes/lines"' + sign+=' +\:"print the first specified bytes/lines (default)"))' + digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' + if compset -P '*[0-9]'; then + _alternative $mlt $digit && ret=0 + elif [[ -z $PREFIX ]]; then + _alternative $sign $digit && ret=0 + elif compset -P '(+|-)'; then + _alternative $digit && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index e7c21b9d1..8d31cd377 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -163,19 +163,26 @@ _hg_revrange() { } _hg_tags_internal() { - local expl + local -a expl typeset -a hgtags hgtags=( ${(f)"$(_hg_cmd tags -q 2>/dev/null)"} ) _wanted tags expl 'tags' compadd -a - hgtags } _hg_bookmarks_internal() { - local expl + local -a expl typeset -a hgbookmarks hgbookmarks=( ${(f)"$(_hg_cmd bookmarks -q 2>/dev/null)"} ) _wanted bookmarks expl 'bookmarks' compadd -a - hgbookmarks } +_hg_branches_internal() { + local -a expl + typeset -a hgbranches + hgbranches=( ${(f)"$(_hg_cmd branches -q 2>/dev/null)"} ) + _wanted branches expl 'branches' compadd -a - hgbranches +} + _hg_tags() { _alternative \ 'bookmarks:bookmark:_hg_bookmarks_internal' \ @@ -352,7 +359,7 @@ _hg_clone_dest() { # Common options _hg_global_opts=( - '(--repository -R)'{-R+,--repository}'[repository root directory]:repository:_files -/' + '(--repository -R)'{-R+,--repository=}'[repository root directory]:repository:_files -/' '--cwd[change working directory]:new working directory:_files -/' '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]' '(--verbose -v)'{-v,--verbose}'[enable additional output]' @@ -371,8 +378,8 @@ _hg_global_opts=( ) _hg_pat_opts=( - '*'{-I+,--include}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' - '*'{-X+,--exclude}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') + '*'{-I+,--include=}'[include names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/' + '*'{-X+,--exclude=}'[exclude names matching the given patterns]:dir:_files -W $(_hg_cmd root) -/') _hg_diff_opts=( '(--text -a)'{-a,--text}'[treat all files as text]' @@ -388,11 +395,11 @@ _hg_style_opts=( _hg_commit_opts=( '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]' - '(-e --edit -l --logfile --message -m)'{-m+,--message}'[use <text> as commit message]:message:' - '(-e --edit -m --message --logfile -l)'{-l+,--logfile}'[read the commit message from <file>]:log file:_files') + '(-e --edit -l --logfile --message -m)'{-m+,--message=}'[use <text> as commit message]:message:' + '(-e --edit -m --message --logfile -l)'{-l+,--logfile=}'[read the commit message from <file>]:log file:_files') _hg_remote_opts=( - '(--ssh -e)'{-e+,--ssh}'[specify ssh command to use]:' + '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:' '--remotecmd[specify hg command to run on the remote side]:') _hg_cmd() { @@ -401,19 +408,19 @@ _hg_cmd() { } _hg_cmd_add() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ '*:unknown files:_hg_unknown' } _hg_cmd_addremove() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ - '(--similarity -s)'{-s+,--similarity}'[guess renamed files by similarity (0<=s<=100)]:' \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ + '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:' \ '*:unknown or missing files:_hg_addremove' } _hg_cmd_annotate() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ - '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ + '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_tags' \ '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \ '(--text -a)'{-a,--text}'[treat all files as text]' \ '(--user -u)'{-u,--user}'[list the author]' \ @@ -424,48 +431,58 @@ _hg_cmd_annotate() { } _hg_cmd_archive() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '--no-decode[do not pass files through decoders]' \ - '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \ - '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \ - '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ + '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:' \ + '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_tags' \ + '(--type -t)'{-t+,--type=}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \ '*:destination:_files' } _hg_cmd_backout() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '--merge[merge with old dirstate parent after backout]' \ - '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ + '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \ '--parent[parent to choose when backing out merge]' \ - '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ - '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ - '(--message -m)'{-m+,--message}'[specify commit message]:text' \ - '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' + '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \ + '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ + '(--message -m)'{-m+,--message=}'[specify commit message]:text' \ + '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' } _hg_cmd_bisect() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(-)'{-r,--reset}'[reset bisect state]' \ '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \ '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \ '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \ - '(--command -c --noupdate -U)'{-c+,--command}'[use command to check changeset state]':commands:_command_names \ + '(--command -c --noupdate -U)'{-c+,--command=}'[use command to check changeset state]':commands:_command_names \ '(--command -c --noupdate -U)'{-U,--noupdate}'[do not update to target]' } +_hg_cmd_bookmarks() { + _arguments -s : $_hg_global_opts \ + '(--force -f)'{-f,--force}'[force]' \ + '(--rev -r)'{-r+,--rev=}'[set bookmark at revision]:revision:_hg_tags' \ + '(--delete -d)'{-d,--delete}'[delete a given bookmark]' \ + '(--rename -m)'{-m+,--rename=}'[rename given bookmark]:bookmark:_hg_bookmarks_internal' \ + '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \ + ':bookmark:_hg_bookmarks_internal' +} + _hg_cmd_branch() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \ '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]' } _hg_cmd_branches() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]' } _hg_cmd_bundle() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts \ '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \ '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \ ':output file:_files' \ @@ -473,33 +490,33 @@ _hg_cmd_bundle() { } _hg_cmd_cat() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ - '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ - '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ + '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:filespec:' \ + '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ '*:file:_hg_files' } _hg_cmd_clone() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts \ '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \ - '(--rev -r)'{-r+,--rev}'[a changeset you would like to have after cloning]:' \ + '(--rev -r)'{-r+,--rev=}'[a changeset you would like to have after cloning]:' \ '--uncompressed[use uncompressed transfer (fast over LAN)]' \ ':source repository:_hg_remote' \ ':destination:_hg_clone_dest' } _hg_cmd_commit() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \ - '(--message -m)'{-m+,--message}'[specify commit message]:text' \ - '(--logfile -l)'{-l+,--logfile}'[read commit message from specified file]:log file:_files' \ - '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ - '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ + '(--message -m)'{-m+,--message=}'[specify commit message]:text' \ + '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' \ + '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \ + '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \ '*:file:_hg_committable' } _hg_cmd_copy() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \ '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ '*:file:_hg_files' @@ -507,8 +524,8 @@ _hg_cmd_copy() { _hg_cmd_diff() { typeset -A opt_args - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ - '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ + '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \ '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ @@ -527,99 +544,99 @@ _hg_cmd_diff() { } _hg_cmd_export() { - _arguments -s -w : $_hg_global_opts $_hg_diff_opts \ + _arguments -s : $_hg_global_opts $_hg_diff_opts \ '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \ '--switch-parent[diff against the second parent]' \ '*:revision:_hg_tags' } _hg_cmd_grep() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \ '--all[print all revisions with matches]' \ '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \ '(--ignore-case -i)'{-i,--ignore-case}'[ignore case when matching]' \ '(--files-with-matches -l)'{-l,--files-with-matches}'[print only filenames and revs that match]' \ '(--line-number -n)'{-n,--line-number}'[print matching line numbers]' \ - '*'{-r+,--rev}'[search in given revision range]:revision:_hg_revrange' \ + '*'{-r+,--rev=}'[search in given revision range]:revision:_hg_revrange' \ '(--user -u)'{-u,--user}'[print user who committed change]' \ '1:search pattern:' \ '*:files:_hg_files' } _hg_cmd_heads() { - _arguments -s -w : $_hg_global_opts $_hg_style_opts \ - '(--rev -r)'{-r+,--rev}'[show only heads which are descendants of rev]:revision:_hg_tags' + _arguments -s : $_hg_global_opts $_hg_style_opts \ + '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_tags' } _hg_cmd_help() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '*:mercurial command:_hg_commands' } _hg_cmd_identify() { - _arguments -s -w : $_hg_global_opts \ - '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_tags' \ - '(--num -n)'{-n+,--num}'[show local revision number]' \ - '(--id -i)'{-i+,--id}'[show global revision id]' \ - '(--branch -b)'{-b+,--branch}'[show branch]' \ - '(--tags -t)'{-t+,--tags}'[show tags]' + _arguments -s : $_hg_global_opts \ + '(--rev -r)'{-r+,--rev=}'[identify the specified rev]:revision:_hg_tags' \ + '(--num -n)'{-n+,--num=}'[show local revision number]' \ + '(--id -i)'{-i+,--id=}'[show global revision id]' \ + '(--branch -b)'{-b+,--branch=}'[show branch]' \ + '(--tags -t)'{-t+,--tags=}'[show tags]' } _hg_cmd_import() { - _arguments -s -w : $_hg_global_opts \ - '(--strip -p)'{-p+,--strip}'[directory strip option for patch (default: 1)]:count:' \ - '(--message -m)'{-m+,--message}'[use <text> as commit message]:text:' \ + _arguments -s : $_hg_global_opts \ + '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count:' \ + '(--message -m)'{-m+,--message=}'[use <text> as commit message]:text:' \ '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \ '*:patch:_files' } _hg_cmd_incoming() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ '(--patch -p)'{-p,--patch}'[show patch]' \ - '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \ + '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \ '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ '--bundle[file to store the bundles into]:bundle file:_files' \ ':source:_hg_remote' } _hg_cmd_init() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts \ ':dir:_files -/' } _hg_cmd_locate() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ - '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ + '(--rev -r)'{-r+,--rev=}'[search repository as it stood at revision]:revision:_hg_tags' \ '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \ '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \ '*:search pattern:_hg_files' } _hg_cmd_log() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \ '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \ '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \ '(--copies -C)'{-C,--copies}'[show copied files]' \ - '(--keyword -k)'{-k+,--keyword}'[search for a keyword]:' \ - '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ + '(--keyword -k)'{-k+,--keyword=}'[search for a keyword]:' \ + '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:' \ '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \ '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \ '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \ '(--patch -p)'{-p,--patch}'[show patch]' \ - '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ + '(--prune -P)'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_tags' \ '*:files:_hg_files' } _hg_cmd_manifest() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ ':revision:_hg_tags' } _hg_cmd_merge() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \ '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \ '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \ @@ -627,50 +644,54 @@ _hg_cmd_merge() { } _hg_cmd_outgoing() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \ '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \ '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ '(--patch -p)'{-p,--patch}'[show patch]' \ - '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]' \ + '(--rev -r)'{-r+,--rev=}'[a specific revision you would like to push]' \ '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \ ':destination:_hg_remote' } _hg_cmd_parents() { - _arguments -s -w : $_hg_global_opts $_hg_style_opts \ - '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \ + _arguments -s : $_hg_global_opts $_hg_style_opts \ + '(--rev -r)'{-r+,--rev=}'[show parents of the specified rev]:revision:_hg_tags' \ ':last modified file:_hg_files' } _hg_cmd_paths() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ ':path:_hg_paths' } _hg_cmd_pull() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts \ '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \ '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \ - '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:' \ + '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision:' \ ':source:_hg_remote' } _hg_cmd_push() { - _arguments -s -w : $_hg_global_opts $_hg_remote_opts \ + _arguments -s : $_hg_global_opts $_hg_remote_opts \ '(--force -f)'{-f,--force}'[force push]' \ - '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \ + '(--rev -r)'{-r+,--rev=}'[a specific revision you would like to push]:revision:_hg_tags' \ + '*'{-B,--bookmark=}'[bookmark to push]:bookmark:_hg_bookmarks_internal' \ + '*'{-b,--branch=}'[branch to push]:branch:_hg_branches_internal' \ + '--insecure[do not verify server certificate]' \ + '--new-branch[allow pushing a new branch]' \ ':destination:_hg_remote' } _hg_cmd_remove() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '(--after -A)'{-A,--after}'[record remove that has already occurred]' \ '(--force -f)'{-f,--force}'[remove file even if modified]' \ '*:file:_hg_files' } _hg_cmd_rename() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \ '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \ '*:file:_hg_files' @@ -680,7 +701,7 @@ _hg_cmd_resolve() { local context state line typeset -A opt_args - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \ '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \ '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \ @@ -697,9 +718,9 @@ _hg_cmd_revert() { local context state line typeset -A opt_args - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \ '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ - '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ + '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \ '--no-backup[do not save backup copies of files]' \ '*:file:->diff_files' @@ -717,13 +738,13 @@ _hg_cmd_revert() { } _hg_cmd_serve() { - _arguments -s -w : $_hg_global_opts \ - '(--accesslog -A)'{-A+,--accesslog}'[name of access log file]:log file:_files' \ - '(--errorlog -E)'{-E+,--errorlog}'[name of error log file]:log file:_files' \ + _arguments -s : $_hg_global_opts \ + '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file]:log file:_files' \ + '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file]:log file:_files' \ '(--daemon -d)'{-d,--daemon}'[run server in background]' \ - '(--port -p)'{-p+,--port}'[listen port]:listen port:' \ - '(--address -a)'{-a+,--address}'[interface address]:interface address:' \ - '(--name -n)'{-n+,--name}'[name to show in web pages]:repository name:' \ + '(--port -p)'{-p+,--port=}'[listen port]:listen port:' \ + '(--address -a)'{-a+,--address=}'[interface address]:interface address:' \ + '(--name -n)'{-n+,--name=}'[name to show in web pages]:repository name:' \ '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \ '--style[web template style]:style' \ '--stdio[for remote clients]' \ @@ -731,13 +752,13 @@ _hg_cmd_serve() { } _hg_cmd_showconfig() { - _arguments -s -w : $_hg_global_opts \ - '(--untrusted -u)'{-u+,--untrusted}'[show untrusted configuration options]' \ + _arguments -s : $_hg_global_opts \ + '(--untrusted -u)'{-u+,--untrusted=}'[show untrusted configuration options]' \ ':config item:_hg_config' } _hg_cmd_status() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '(--all -A)'{-A,--all}'[show status of all files]' \ '(--modified -m)'{-m,--modified}'[show only modified files]' \ '(--added -a)'{-a,--added}'[show only added files]' \ @@ -754,37 +775,37 @@ _hg_cmd_status() { } _hg_cmd_tag() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--local -l)'{-l,--local}'[make the tag local]' \ - '(--message -m)'{-m+,--message}'[message for tag commit log entry]:message:' \ - '(--date -d)'{-d+,--date}'[record datecode as commit date]:date code:' \ - '(--user -u)'{-u+,--user}'[record user as commiter]:user:' \ - '(--rev -r)'{-r+,--rev}'[revision to tag]:revision:_hg_tags' \ + '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message:' \ + '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \ + '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \ + '(--rev -r)'{-r+,--rev=}'[revision to tag]:revision:_hg_tags' \ ':tag name:' } _hg_cmd_tip() { - _arguments -s -w : $_hg_global_opts $_hg_style_opts \ + _arguments -s : $_hg_global_opts $_hg_style_opts \ '(--patch -p)'{-p,--patch}'[show patch]' } _hg_cmd_unbundle() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \ ':files:_files' } _hg_cmd_update() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \ - '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \ + '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \ ':revision:_hg_tags' } # HGK _hg_cmd_view() { - _arguments -s -w : $_hg_global_opts \ - '(--limit -l)'{-l+,--limit}'[limit number of changes displayed]:' \ + _arguments -s : $_hg_global_opts \ + '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:' \ ':revision range:_hg_tags' } @@ -838,35 +859,35 @@ _hg_qseries_opts=( '(--summary -s)'{-s,--summary}'[print first line of patch header]') _hg_cmd_qapplied() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts + _arguments -s : $_hg_global_opts $_hg_qseries_opts } _hg_cmd_qdelete() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--keep -k)'{-k,--keep}'[keep patch file]' \ - '*'{-r+,--rev}'[stop managing a revision]:applied patch:_hg_revrange' \ + '*'{-r+,--rev=}'[stop managing a revision]:applied patch:_hg_revrange' \ '*:unapplied patch:_hg_qdeletable' } _hg_cmd_qdiff() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts \ '*:pattern:_hg_files' } _hg_cmd_qfold() { - _arguments -s -w : $_hg_global_opts $_h_commit_opts \ + _arguments -s : $_hg_global_opts $_h_commit_opts \ '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ '*:unapplied patch:_hg_qunapplied' } _hg_cmd_qgoto() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--force -f)'{-f,--force}'[overwrite any local changes]' \ ':patch:_hg_qseries' } _hg_cmd_qguard() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--list -l)'{-l,--list}'[list all patches and guards]' \ '(--none -n)'{-n,--none}'[drop all guards]' \ ':patch:_hg_qseries' \ @@ -874,66 +895,66 @@ _hg_cmd_qguard() { } _hg_cmd_qheader() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ ':patch:_hg_qseries' } _hg_cmd_qimport() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--existing -e)'{-e,--existing}'[import file in patch dir]' \ - '(--name -n 2)'{-n+,--name}'[patch file name]:name:' \ + '(--name -n 2)'{-n+,--name=}'[patch file name]:name:' \ '(--force -f)'{-f,--force}'[overwrite existing files]' \ - '*'{-r+,--rev}'[place existing revisions under mq control]:revision:_hg_revrange' \ + '*'{-r+,--rev=}'[place existing revisions under mq control]:revision:_hg_revrange' \ '*:patch:_files' } _hg_cmd_qnew() { - _arguments -s -w : $_hg_global_opts $_hg_commit_opts \ + _arguments -s : $_hg_global_opts $_hg_commit_opts \ '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \ ':patch:' } _hg_cmd_qnext() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts + _arguments -s : $_hg_global_opts $_hg_qseries_opts } _hg_cmd_qpop() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--all -a :)'{-a,--all}'[pop all patches]' \ - '(--name -n)'{-n+,--name}'[queue name to pop]:' \ + '(--name -n)'{-n+,--name=}'[queue name to pop]:' \ '(--force -f)'{-f,--force}'[forget any local changes]' \ ':patch:_hg_qapplied' } _hg_cmd_qprev() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts + _arguments -s : $_hg_global_opts $_hg_qseries_opts } _hg_cmd_qpush() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--all -a :)'{-a,--all}'[apply all patches]' \ '(--list -l)'{-l,--list}'[list patch name in commit text]' \ - '(--merge -m)'{-m+,--merge}'[merge from another queue]:' \ - '(--name -n)'{-n+,--name}'[merge queue name]:' \ + '(--merge -m)'{-m+,--merge=}'[merge from another queue]:' \ + '(--name -n)'{-n+,--name=}'[merge queue name]:' \ '(--force -f)'{-f,--force}'[apply if the patch has rejects]' \ ':patch:_hg_qunapplied' } _hg_cmd_qrefresh() { - _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ + _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \ '(--git -g)'{-g,--git}'[use git extended diff format]' \ '(--short -s)'{-s,--short}'[short refresh]' \ '*:files:_hg_files' } _hg_cmd_qrename() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ ':patch:_hg_qseries' \ ':destination:' } _hg_cmd_qselect() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--none -n :)'{-n,--none}'[disable all guards]' \ '(--series -s :)'{-s,--series}'[list all guards in series file]' \ '--pop[pop to before first guarded applied patch]' \ @@ -942,20 +963,20 @@ _hg_cmd_qselect() { } _hg_cmd_qseries() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts \ + _arguments -s : $_hg_global_opts $_hg_qseries_opts \ '(--missing -m)'{-m,--missing}'[print patches not in series]' } _hg_cmd_qunapplied() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts + _arguments -s : $_hg_global_opts $_hg_qseries_opts } _hg_cmd_qtop() { - _arguments -s -w : $_hg_global_opts $_hg_qseries_opts + _arguments -s : $_hg_global_opts $_hg_qseries_opts } _hg_cmd_strip() { - _arguments -s -w : $_hg_global_opts \ + _arguments -s : $_hg_global_opts \ '(--force -f)'{-f,--force}'[force multi-head removal]' \ '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \ '(--nobackup -n)'{-n,--nobackup}'[no backups]' \ diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb new file mode 100644 index 000000000..16e346cfb --- /dev/null +++ b/Completion/Unix/Command/_lldb @@ -0,0 +1,55 @@ +#compdef lldb + +local curcontext=$curcontext state state_descr line expl ret=1 +typeset -A opt_args +local -a args + +args=( + '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: ' + '*'{-s+,--source=}'[run lldb commands from a file after loading executable]:file:_files' + '*'{-O+,--one-line-before-file=}'[run one-line lldb command before loading executable]:lldb command' + '*'{-S+,--source-before-file=}'[run lldb commands from a file before loading executable]:file:_files' + '(-k --one-line-on-crash)'{-k+,--one-line-on-crash=}'[run one-line lldb command if target crashes in batch mode]:lldb command' + '(-K --source-on-crash)'{-K+,--source-on-crash=}'[run lldb commands from a file if target crashes in batch mode]:file:_files' + '(-b --batch)'{-b,--batch}'[run commands from -s -S -o -O and quit]' + '(-Q --source-quietly)'{-Q,--source-quietly}'[suppress output from -s, -S, -o or -O]' + '(-e --editor)'{-e,--editor}'[open source files using "external editor" mechanism]' + '(-x --no-lldbinit)'{-x,--no-lldbinit}'[do not automatically parse .lldbinit files]' + '(-X --no-use-colors)'{-X,--no-use-colors}'[do not use colors]' + '(-d --debug)'{-d,--debug}'[print extra information for debugging itself]' + '(-r --repl)'{-r,--repl}'[run lldb in REPL mode]' + '(-l --script-language)'{-l+,--script-language=}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)' + - info + '(-)'{-h,--help}'[print the usage information]' + '(-)'{-v,--version}'[print the current version number]' + '(-)'{-P,--python-path}'[print path to the lldb.py file]' + - file + '(-f --file)'{-f+,--file=}'[specify executable file to debug]:executable:_files -g "*(-*)"' + '(-a --arch)'{-a+,--arch=}'[use the specified architecture]:arch' + '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"' + '*::executable and arguments:->exe_args' + - name + '(-n --attach-name)'{-n+,--attach-name=}'[attach to the named process]:process name' + '(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]' + - pid + '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids' +) + +_arguments -C -s -S : $args && return 0 + +case $state in + (exe_args) + if [[ -z $opt_args[(I)file-(-f|--file)] ]]; then + if [[ $CURRENT -eq 1 ]]; then + _wanted executables expl 'executable' _files -g '*(-*)' && ret=0 + else + _normal && ret=0 + fi + else + words=( ${(v)opt_args[(i)file-(-f|--file)]} "$words[@]" ) + (( CURRENT++ )) + _normal && ret=0 + fi +esac + +return ret diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 80136329d..d171ef5a3 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -6,7 +6,7 @@ _nm_object_file() { [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]] } -files="*:object file:_files -g '*(-.e:_nm_object_file:)'" +files="*:object file:_files -g '*(-.e,_nm_object_file,)'" args=( '(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]' '(--demangle)-C[decode symbol names]' diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump new file mode 100644 index 000000000..607719a19 --- /dev/null +++ b/Completion/Unix/Command/_objdump @@ -0,0 +1,8 @@ +#compdef objdump + +# borrowed from _nm_object_file +_objdump_object_file() { + [[ -x $REPLY || $REPLY = *.([ao]|so|elf) ]] +} + +_arguments -- '*:object file:_files -g "*(-.e,_objdump_object_file,)"' diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu index db07eba33..3c21c3e74 100644 --- a/Completion/Unix/Command/_qemu +++ b/Completion/Unix/Command/_qemu @@ -2,7 +2,7 @@ _qemu_log_items () { local -a opts hline - $service -d \? | while read -A hline; do + $service -d \? 2>/dev/null | while read -A hline; do [[ $hline[1] = Log ]] && continue opts=($opts "${hline[1]}[${hline[2,-1]}]") done @@ -11,7 +11,7 @@ _qemu_log_items () { local _qemu_machines -_qemu_machines=(${${${(f)"$($service -M \?)"}[2,-1]}%% *}) +_qemu_machines=(${${${(f)"$($service -M \? 2>/dev/null)"}[2,-1]}%% *}) _arguments \ '-'{fda,fdb,hda,hdb,hdc,hdd,cdrom}':disk image:_files' \ diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 8e2385cc8..cc7a9631d 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -38,12 +38,8 @@ else '-a[delay opening files listed with w function]' ) ;| - darwin*|freebsd*|netbsd*) - args+=( - '-i'$inplace - '-l[make output line buffered]' - ) - ;| + darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i'$inplace ) ;| + darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;| freebsd*) args+=( '-u[disable data buffering]' ) ;| freebsd*|netbsd*) args+=( diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index 21ebfc3b2..2afb46621 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,13 +1,4 @@ -#compdef sh ksh bash zsh csh tcsh rc - -if [[ $service == zsh ]]; then - # try a bit harder - if [[ ${words[CURRENT-1]} == -o ]]; then - _options - # no other possibilities - return - fi -fi +#compdef sh ksh bash csh tcsh rc if (( CURRENT == ${words[(i)-c]} + 1 )); then _cmdstring @@ -21,9 +12,3 @@ else fi _default fi - -local ret=$? - -[[ $service == zsh ]] && _arguments -S -s -- '*:' && ret=0 - -return ret diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index a66702a65..c6ede9efe 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -18,7 +18,7 @@ _ssh () { # for protocol version 2, this can be a comma-separated list '-c+[select encryption cipher]:encryption cipher:(idea des 3des blowfish arcfour tss none)' '-F+[specify alternate config file]:config file:_files' - '*-i+[select identity file]:SSH identity file:_files' + '*-i+[select identity file]:SSH identity file:_files -g "*(-.^AR)"' '*-o+[specify extra options]:option string:->option' ) common_transfer=( diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd deleted file mode 100644 index 028ecddd9..000000000 --- a/Completion/Unix/Command/_systemd +++ /dev/null @@ -1,470 +0,0 @@ -#compdef systemctl systemd-loginctl - -# Copyright (c) 2011 Foudil Bre'tel <foudil.newbie+zshsystemctl@gmail.com> -# -# This file is released under the GPLv3. -# -# inspired from _yum and systemctl-bash-completion.sh (shipped with systemctl) -# -# TODO: enable options after commands. Ex: systemctl list-units --all --full - -# Main dispatcher -_systemd() -{ - local curcontext="$curcontext" state lstate line - - case "$service" in - systemctl) - # -s for aggregated options like -aP - _arguments -s \ - {-h,--help}'[Show help]' \ - '--version[Show package version]' \ - {-t,--type=}'[List only units of a particular type]:unit type:(automount device mount path service snapshot socket swap target timer)' \ - \*{-p,--property=}'[Show only properties by specific name]:unit property:()' \ - {-a,--all}'[Show all units/properties, including dead/empty ones]' \ - '--failed[Show only failed units]' \ - "--full[Don't ellipsize unit names on output]" \ - '--fail[When queueing a new job, fail if conflicting jobs are pending]' \ - '--ignore-dependencies[When queueing a new job, ignore all its dependencies]' \ - '--kill-mode=[How to send signal]:killmode:(control-group process)' \ - '--kill-who=[Who to send signal to]:killwho:(main control all)' \ - {-s,--signal=}'[Which signal to send]:signal:_signals' \ - {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \ - {-P,--privileged}'[Acquire privileges before execution]' \ - {-q,--quiet}'[Suppress output]' \ - '--no-block[Do not wait until operation finished]' \ - "--no-wall[Don't send wall message before halt/power-off/reboot]" \ - "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \ - '--no-legend[Do not print a legend, i.e. the column headers and the footer with hints]' \ - '--no-pager[Do not pipe output into a pager]' \ - '--no-ask-password[Do not ask for system passwords]' \ - '--order[When generating graph for dot, show only order]' \ - '--require[When generating graph for dot, show only requirement]' \ - '--system[Connect to system manager]' \ - '--user[Connect to user service manager]' \ - '--global[Enable/disable unit files globally]' \ - {-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \ - '--root=[Enable unit files in the specified root directory]:directory:_directories' \ - '--runtime[Enable unit files only temporarily until next reboot]' \ - '*::systemctl command:_systemctl_command' - ;; - - systemd-loginctl) - _arguments -s \ - {-h,--help}'[Show help]' \ - '--version[Show package version]' \ - \*{-p,--property=}'[Show only properties by this name]:unit property:' \ - {-a,--all}'[Show all properties, including empty ones]' \ - '--failed[Show only failed units]' \ - '--kill-who=[Who to send signal to]:killwho:(main control all)' \ - {-s,--signal=}'[Which signal to send]:signal:_signals' \ - {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \ - {-P,--privileged}'[Acquire privileges before execution]' \ - '--no-pager[Do not pipe output into a pager]' \ - '*::systemd-loginctl command:_systemd_loginctl_command' - ;; - - *) _message 'eh?' ;; - esac - -} - -_hosts_or_user_at_host() -{ - _alternative \ - 'users-hosts:: _user_at_host' \ - 'hosts:: _hosts' -} - -(( $+functions[_systemctl_command] )) || _systemctl_command() -{ - local -a _systemctl_cmds - _systemctl_cmds=( - "list-units:List units" - "start:Start (activate) one or more units" - "stop:Stop (deactivate) one or more units" - "reload:Reload one or more units" - "restart:Start or restart one or more units" - "condrestart:Restart one or more units if active" - "try-restart:Restart one or more units if active" - "reload-or-restart:Reload one or more units is possible, otherwise start or restart" - "force-reload:Reload one or more units is possible, otherwise restart if active" - "reload-or-try-restart:Reload one or more units is possible, otherwise restart if active" - "isolate:Start one unit and stop all others" - "kill:Send signal to processes of a unit" - "is-active:Check whether units are active" - "status:Show runtime status of one or more units" - "show:Show properties of one or more units/jobs or the manager" - "reset-failed:Reset failed state for all, one, or more units" - "load:Load one or more units" - "list-unit-files:List installed unit files" - "enable:Enable one or more unit files" - "disable:Disable one or more unit files" - "reenable:Reenable one or more unit files" - "preset:Enable/disable one or more unit files based on preset configuration" - "mask:Mask one or more units" - "unmask:Unmask one or more units" - "link:Link one or more units files into the search path" - "is-enabled:Check whether unit files are enabled" - "list-jobs:List jobs" - "cancel:Cancel all, one, or more jobs" - "dump:Dump server status" - "dot:Dump dependency graph for dot(1)" - "snapshot:Create a snapshot" - "delete:Remove one or more snapshots" - "show-environment:Dump environment" - "set-environment:Set one or more environment variables" - "unset-environment:Unset one or more environment variables" - "daemon-reload:Reload systemd manager configuration" - "daemon-reexec:Reexecute systemd manager" - "default:Enter system default mode" - "rescue:Enter system rescue mode" - "emergency:Enter system emergency mode" - "halt:Shut down and halt the system" - "poweroff:Shut down and power-off the system" - "reboot:Shut down and reboot the system" - "kexec:Shut down and reboot the system with kexec" - "exit:Ask for user instance termination" - "switch-root:Change to a different root file system" - "suspend:Suspend the system" - "hibernate:Hibernate the system" - "hibernate-sleep:Hibernate and suspend the system" - ) - - if (( CURRENT == 1 )); then - _describe -t commands 'systemctl command' _systemctl_cmds - else - local curcontext="$curcontext" ret - - cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}" - # Deal with any aliases - case $cmd in - condrestart) cmd="try-restart";; - force-reload) cmd="reload-or-try-restart";; - esac - - if (( $#cmd )); then - curcontext="${curcontext%:*:*}:systemctl-${cmd}:" - - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy - fi - - _call_function ret _systemctl_$cmd || _message 'no more arguments' - else - _message "unknown systemctl command: $words[1]" - fi - return ret - fi -} - -__systemctl() -{ - systemctl --full --no-legend --no-pager "$@" -} - - -# Fills the unit list -_systemctl_all_units() -{ - if ( [[ ${+_sys_all_units} -eq 0 ]] || _cache_invalid SYS_ALL_UNITS ) && - ! _retrieve_cache SYS_ALL_UNITS; - then - _sys_all_units=( $(__systemctl list-units --all | { while read a b; do echo "$a"; done; }) ) - _store_cache SYS_ALL_UNITS _sys_all_units - fi -} - -# Fills the unit list including all file units -_systemctl_really_all_units() -{ - local -a all_unit_files; - local -a really_all_units; - if ( [[ ${+_sys_really_all_units} -eq 0 ]] || _cache_invalid SYS_REALLY_ALL_UNITS ) && - ! _retrieve_cache SYS_REALLY_ALL_UNITS; - then - all_unit_files=( $(__systemctl list-unit-files | { while read a b; do echo "$a"; done; }) ) - _systemctl_all_units - really_all_units=($_sys_all_units $all_unit_files) - _sys_really_all_units=(${(u)really_all_units}) - _store_cache SYS_REALLY_ALL_UNITS _sys_really_all_units - fi -} - -_filter_units_by_property() { - local property=$1 value=$2 ; shift ; shift - local -a units ; units=($*) - local prop unit - for ((i=1; $i <= ${#units[*]}; i++)); do - # FIXME: "Failed to issue method call: Unknown unit" errors are ignored for - # now (related to DBUS_ERROR_UNKNOWN_OBJECT). in the future, we need to - # revert to calling 'systemctl show' once for all units, which is way - # faster - unit=${units[i]} - prop=$(systemctl show --no-pager --property="$property" ${unit} 2>/dev/null) - if [[ "${prop}" = "$property=$value" ]]; then - echo "${unit}" - fi - done -} - -_systemctl_active_units() {_sys_active_units=( $(__systemctl list-units | { while read a b; do echo "$a"; done; }) )} -_systemctl_inactive_units(){_sys_inactive_units=($(__systemctl list-units --all | { while read a b c d; do [[ $c == "inactive" ]] && echo "$a"; done; }) )} -_systemctl_failed_units() {_sys_failed_units=( $(__systemctl list-units --failed | { while read a b; do echo "$a"; done; }) )} -_systemctl_enabled_units() {_sys_enabled_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "enabled" ]] && echo "$a"; done; }) )} -_systemctl_disabled_units(){_sys_disabled_units=($(__systemctl list-unit-files | { while read a b; do [[ $b == "disabled" ]] && echo "$a"; done; }) )} -_systemctl_masked_units() {_sys_masked_units=( $(__systemctl list-unit-files | { while read a b; do [[ $b == "masked" ]] && echo "$a"; done; }) )} - -# Completion functions for ALL_UNITS -for fun in is-active is-enabled status show mask preset ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - _systemctl_really_all_units - compadd "$@" -a - _sys_really_all_units - } -done - -# Completion functions for ENABLED_UNITS -for fun in disable reenable ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - _systemctl_enabled_units - compadd "$@" -a - _sys_enabled_units - } -done - -# Completion functions for DISABLED_UNITS -(( $+functions[_systemctl_enable] )) || _systemctl_enable() -{ - _systemctl_disabled_units - compadd "$@" -a - _sys_disabled_units -} - -# Completion functions for FAILED_UNITS -(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed() -{ - _systemctl_failed_units - compadd "$@" -a - _sys_failed_units || _message "no failed unit found" -} - -# Completion functions for STARTABLE_UNITS -(( $+functions[_systemctl_start] )) || _systemctl_start() -{ - _systemctl_inactive_units - compadd "$@" -a - _sys_inactive_units -} - -# Completion functions for STOPPABLE_UNITS -for fun in stop kill try-restart condrestart ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - _systemctl_active_units - compadd "$@" - $( _filter_units_by_property CanStop yes \ - ${_sys_active_units[*]} ) - } -done - -# Completion functions for ISOLATABLE_UNITS -(( $+functions[_systemctl_isolate] )) || _systemctl_isolate() -{ - _systemctl_all_units - compadd "$@" - $( _filter_units_by_property AllowIsolate yes \ - ${_sys_all_units[*]} ) -} - -# Completion functions for RELOADABLE_UNITS -for fun in reload reload-or-try-restart force-reload ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - _systemctl_active_units - compadd "$@" - $( _filter_units_by_property CanReload yes \ - ${_sys_active_units[*]} ) - } -done - -# Completion functions for RESTARTABLE_UNITS -for fun in restart reload-or-restart ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - _systemctl_all_units - compadd "$@" - $( _filter_units_by_property CanStart yes \ - ${_sys_all_units[*]} | while read line; do \ - [[ "$line" =~ \.(device|snapshot|socket|timer)$ ]] || echo "$line"; \ - done ) - } -done - -# Completion functions for MASKED_UNITS -(( $+functions[_systemctl_unmask] )) || _systemctl_unmask() -{ - _systemctl_masked_units - compadd "$@" -a - _sys_masked_units || _message "no masked unit found" -} - -# Completion functions for JOBS -(( $+functions[_systemctl_cancel] )) || _systemctl_cancel() -{ - compadd "$@" - $(__systemctl list-jobs \ - | cut -d' ' -f1 2>/dev/null ) || _message "no job found" -} - -# Completion functions for SNAPSHOTS -(( $+functions[_systemctl_delete] )) || _systemctl_delete() -{ - compadd "$@" - $(__systemctl list-units --type snapshot --all \ - | cut -d' ' -f1 2>/dev/null ) || _message "no snampshot found" -} - -# Completion functions for ENVS -for fun in set-environment unset-environment ; do - (( $+functions[_systemctl_$fun] )) || _systemctl_$fun() - { - local fun=$0 ; fun=${fun##_systemctl_} - local suf - if [[ "${fun}" = "set-environment" ]]; then - suf='-S=' - fi - - compadd "$@" ${suf} - $(systemctl show-environment \ - | while read line; do echo "${line%%\=}";done ) - } -done - -(( $+functions[_systemctl_link] )) || _systemctl_link() { _files } - -(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() -{ - if (( CURRENT == 2 )); then - _directories - fi -} - -# no systemctl completion for: -# [STANDALONE]='daemon-reexec daemon-reload default dot dump -# emergency exit halt kexec list-jobs list-units -# list-unit-files poweroff reboot rescue show-environment' -# [NAME]='snapshot load' - -_systemctl_caching_policy() -{ - local _sysunits - local -a oldcache - - # rebuild if cache is more than a day old - oldcache=( "$1"(mh+1) ) - (( $#oldcache )) && return 0 - - _sysunits=($(__systemctl --all | cut -d' ' -f1)) - - if (( $#_sysunits )); then - for unit in $_sysunits; do - [[ "$unit" -nt "$1" ]] && return 0 - done - fi - - return 1 -} - - - -_systemd_loginctl_all_sessions(){_sys_all_sessions=($(systemd-loginctl list-sessions | { while read a b; do echo "$a"; done; }) )} -_systemd_loginctl_all_users() {_sys_all_users=( $(systemd-loginctl list-users | { while read a b; do echo "$a"; done; }) )} -_systemd_loginctl_all_seats() {_sys_all_seats=( $(systemd-loginctl list-seats | { while read a b; do echo "$a"; done; }) )} - -# Completion functions for SESSIONS -for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do - (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun() - { - _systemd_loginctl_all_sessions - compadd "$@" -a - _sys_all_sessions - } -done - -# Completion functions for USERS -for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do - (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun() - { - _systemd_loginctl_all_users - compadd "$@" -a - _sys_all_users - } -done - -# Completion functions for SEATS -(( $+functions[_systemd_loginctl_seats] )) || _systemd_loginctl_seats() -{ - _systemd_loginctl_all_seats - compadd "$@" -a - _sys_all_seats -} -for fun in seat-status show-seat terminate-seat ; do - (( $+functions[_systemd_loginctl_$fun] )) || _systemd_loginctl_$fun() - { _systemd_loginctl_seats } -done - -# Completion functions for ATTACH -(( $+functions[_systemd_loginctl_attach] )) || _systemd_loginctl_attach() -{ - _systemd_loginctl_all_seats - - _arguments -w -C -S -s \ - ':seat:_systemd_loginctl_seats' \ - '*:device:_files' -} - -# no systemd-loginctl completion for: -# [STANDALONE]='list-sessions list-users list-seats flush-devices' - -(( $+functions[_systemd_loginctl_command] )) || _systemd_loginctl_command() -{ - local -a _systemd_loginctl_cmds - _systemd_loginctl_cmds=( - "list-sessions:List sessions" - "session-status:Show session status" - "show-session:Show properties of one or more sessions" - "activate:Activate a session" - "lock-session:Screen lock one or more sessions" - "unlock-session:Screen unlock one or more sessions" - "terminate-session:Terminate one or more sessions" - "kill-session:Send signal to processes of a session" - "list-users:List users" - "user-status:Show user status" - "show-user:Show properties of one or more users" - "enable-linger:Enable linger state of one or more users" - "disable-linger:Disable linger state of one or more users" - "terminate-user:Terminate all sessions of one or more users" - "kill-user:Send signal to processes of a user" - "list-seats:List seats" - "seat-status:Show seat status" - "show-seat:Show properties of one or more seats" - "attach:Attach one or more devices to a seat" - "flush-devices:Flush all device associations" - "terminate-seat:Terminate all sessions on one or more seats" - ) - - if (( CURRENT == 1 )); then - _describe -t commands 'systemd-loginctl command' _systemd_loginctl_cmds || compadd "$@" - else - local curcontext="$curcontext" - - cmd="${${_systemd_loginctl_cmds[(r)$words[1]:*]%%:*}}" - - if (( $#cmd )); then - curcontext="${curcontext%:*:*}:systemd_loginctl-${cmd}:" - - _call_function ret _systemd_loginctl_$cmd || _message 'no more arguments' - else - _message "unknown systemd-loginctl command: $words[1]" - fi - return ret - fi -} - -_systemd "$@" - -# Local Variables: -# mode: sh -# sh-indentation: 2 -# indent-tabs-mode: nil -# sh-basic-offset: 2 -# End: diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail new file mode 100644 index 000000000..fbe30f13a --- /dev/null +++ b/Completion/Unix/Command/_tail @@ -0,0 +1,69 @@ +#compdef tail + +local curcontext=$curcontext state state_descr line opts args ret=1 +typeset -A opt_args + +if _pick_variant gnu=GNU unix --version; then + args=( + '(-n --lines -c --bytes)'{-c+,--bytes=}'[print the last specified bytes; with +, start at the specified byte]:number of bytes:->number' + '(-n --lines -c --bytes)'{-n+,--lines=}'[print the last specified lines; with +, start at the specified line]:number of lines:->number' + '(-F -f)--follow=-[output appended data as the file grows]::how:(name descriptor)' + '(-F --follow)-f[same as --follow=descriptor]' + '(-f --follow --retry)-F[same as --follow=name --retry]' + '--max-unchanged-stats=[with --follow=name, check file rename after the specified number of iterations]:number of iterations' + '(-s --sleep-interval)'{-s+,--sleep-interval=}'[with -f, sleep the specfied seconds between iterations]:seconds' + '--pid=[with -f, terminate after the specified process dies]:pid:_pids' + '(-q --quiet --silent -v --verbose)'{-q,--quiet,--silent}'[never output headers giving file names]' + '(-q --quiet --silent -v --verbose)'{-v,--verbose}'[always output headers giving file names]' + '--retry[keep trying to open a file even when it becomes inaccessible]' + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) +else + opts=(-A '-*') + args=( + '(-b -n)-c+[start at the specified byte]:bytes relative to the end (with +, beginning) of file' + '(-b -c)-n+[start at the specified line]:lines relative to the end (with +, beginning) of file' + '(-F -r)-f[wait for new data to be appended to the file]' + ) + case $OSTYPE in + (freebsd*|darwin*|dragonfly*|netbsd*|openbsd*|solaris*) + args+=( + '(-f -F)-r[display the file in reverse order]' + ) + ;| + (freebsd*|darwin*|dragonfly*|netbsd*|openbsd*) + args+=( + '(-c -n)-b+[start at the specified block (512-byte)]:blocks relative to the end (with +, beginning) of file' + ) + ;| + (freebsd*|darwin*|dragonfly*|netbsd*) + args+=( '(-f -r)-F[implies -f, but also detect file rename]' ) + ;| + (freebsd*|darwin*|dragonfly*) + args+=( '-q[suppress the headers when displaying multiple files]' ) + ;; + esac +fi + +_arguments -C -s -S $opts : $args '*:file:_files' && return + +case $state in + (number) + local mlt sign digit + mlt='multipliers:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' + mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' + sign='signs:sign:((+\:"start at the specified byte/line"' + sign+=' -\:"output the last specified bytes/lines (default)"))' + digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' + if compset -P '*[0-9]'; then + _alternative $mlt $digit && ret=0 + elif [[ -z $PREFIX ]]; then + _alternative $sign $digit && ret=0 + elif compset -P '(+|-)'; then + _alternative $digit && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index 49c2b63ed..d218cc3f3 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -1,6 +1,6 @@ #compdef tmux -# tmux <http://tmux.sf.net> completion for zsh <http://zsh.sf.net>. +# tmux <http://tmux.github.io> completion for zsh <http://zsh.sf.net>. # # Configuration: # @@ -640,7 +640,7 @@ function _tmux-new-session() { '-t[specify target session]:sessions:__tmux-sessions' '-x[specify width]:width:_guard "[0-9]#" "numeric value"' '-y[specify height]:height:_guard "[0-9]#" "numeric value"' - '*:: :_command' + '*:: :_cmdstring' ) _arguments -s ${args} } @@ -657,7 +657,7 @@ function _tmux-new-window() { '-n[specify a window name]:window name:' '-P[print information about new window after it is created]' '-t[specify target window]:windows:__tmux-windows' - '*:: :_command' + '*:: :_cmdstring' ) _arguments ${args} } @@ -776,7 +776,7 @@ function _tmux-respawn-pane() { args=( '-k[kill window if it is in use]' '-t[choose target pane]:window:__tmux-pane' - '*::command:_command' + '*::command:_cmdstring' ) _arguments ${args} } @@ -787,7 +787,7 @@ function _tmux-respawn-window() { args=( '-k[kill window if it is in use]' '-t[choose target window]:window:__tmux-windows' - '*::command:_command' + '*::command:_cmdstring' ) _arguments ${args} } @@ -809,7 +809,7 @@ function _tmux-run-shell() { args=( '-b[run shell command in background]' '-t[choose target pane]:pane:__tmux-panes' - '*::command:_command' + '*::command:_cmdstring' ) _arguments ${args} } @@ -1042,7 +1042,7 @@ function _tmux-split-window() { # changing the command's name might annoy users. So it stays like # this. '-t[choose target pane]:window:__tmux-panes' - '*:: :_command' + '*:: :_cmdstring' ) _arguments ${args} && return } @@ -1270,7 +1270,6 @@ function __tmux-option-guard() { 'history-limit:'${int_guard} 'lock-after-time:'${int_guard} 'lock-command:MSG:command string' - 'lock-server:DESC:on off' 'message-command-style:__tmux-style' 'message-style:__tmux-style' 'mouse:DESC:on off' @@ -1394,7 +1393,6 @@ function __tmux-session-options() { 'history-limit:number of copy-mode lines per window' 'lock-after-time:lock sessions after N seconds' 'lock-command:command to run for locking a client' - 'lock-server:make lock-after-time lock the server instead of sessions' 'message-command-style:status line message command style' 'message-style:status line message style' 'mouse:enable mouse support' diff --git a/Completion/Unix/Command/_tr b/Completion/Unix/Command/_tr new file mode 100644 index 000000000..d55fab5ff --- /dev/null +++ b/Completion/Unix/Command/_tr @@ -0,0 +1,53 @@ +#compdef tr + +local curcontext="$curcontext" state line expl ret=1 +local args variant +local -A descr +descr=( + -c '[complement characters specified by first string]' + -d '[delete specified characters from input]' + -s '[squeeze repeated instances of character to a single instance]' +) + +_pick_variant -r variant gnu=GNU $OSTYPE --version +case $variant in + gnu) + args=( + '(-c -C --complement)'{-c,-C,--complement}"${descr[-c]}" + '(-d --delete 2)'{-d,--delete}"${descr[-d]}" + '(-s --squeeze-repeats)'{-s,--squeeze-repeats}"${descr[-s]}" + '(- 1 2)--help[display help information]' + '(- 1 2)--version[display version information]' + ) + ;; + darwin*|dragonfly*|*bsd*) + args+=( "(-c)-C$descr[-c]" ) + ;| + darwin*|dragonfly*|freebsd*) + args+=( '-u[guarantee that output is unbuffered]' ) + ;| + *) + for k in c d s; do + args+=( -$k$descr[$k] ) + done + ;; +esac + +_arguments -C -s $args \ + '1:character set:->chsets' \ + '2:character set:->chsets' && ret=0 + +if [[ -n $state ]]; then + if compset -P '*\[:'; then + _wanted characters expl 'character class' \ + compadd -S ":${${QIPREFIX:+]}:-\]}$compstate[quote] " \ + alnum alpha blank cntrl digit graph lower print punct space upper \ + xdigit && return + elif compset -P '*\\'; then + _describe -t characters character \ + '(\\\\:backslash a:alert b:backspace f:form\ feed n:new\ line r:return t:tab v:vertical\ tab)' -S '' && return + fi + _message -e characters 'character set' +fi + +return ret diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index 31ccbf1c2..3653308a1 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -44,8 +44,8 @@ if [[ $service = user* ]]; then "(-U -p)-L[lock user's password]" "(-L -p)-U[unlock user's password]" ) + [[ $OSTYPE = openbsd* ]] || args+=('-a[append groups]') args+=( - '-a[append groups]' '-l[specify new user name]:new username' ':username:_users' ) diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index cd5ad3edc..f3869da43 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -2,7 +2,7 @@ # Synced with the S11U1 man page _zfs() { - local context state line expl + local context state line expl implementation typeset -A opt_args local -a subcmds rw_properties rw_propnames ro_properties create_properties local -a share_nfs_ro_properties share_nfs_rw_properties @@ -10,6 +10,8 @@ _zfs() { local -a share_ro_properties share_rw_properties local -a difffields delegatable_perms + _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris + subcmds=( "create" "destroy" "clone" "promote" "rename" "snapshot" "rollback" "list" "set" "get" "inherit" "mount" "unmount" @@ -18,6 +20,8 @@ _zfs() { "diff" "key" "help" ) + [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail) + share_nfs_ro_properties=( "share.nfs.all" ) @@ -531,6 +535,12 @@ _zfs() { ':filesystem or volume:_zfs_dataset -t fs -t vol' ;; + ("jail"|"unjail") + _arguments \ + '1: : _jails' \ + '2:filesystem:_zfs_dataset -t fs' + ;; + ("help") _arguments -A "-*" \ - set1 \ diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool index f2116dc2e..53022db8a 100644 --- a/Completion/Unix/Command/_zpool +++ b/Completion/Unix/Command/_zpool @@ -2,9 +2,11 @@ # Synced with the S11U1 man page _zpool() { - local context state line expl + local context state line expl implementation local -a subcmds fields ro_props rw_props versions create_properties_dataset + _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris + subcmds=( create destroy add remove list iostat status online offline clear attach detach replace scrub import export diff --git a/Completion/Unix/Command/_zsh b/Completion/Unix/Command/_zsh new file mode 100644 index 000000000..a5414670b --- /dev/null +++ b/Completion/Unix/Command/_zsh @@ -0,0 +1,23 @@ +#compdef zsh + +local curcontext=$curcontext state state_descr line expl +typeset -A opt_args + +_arguments -S -s : \ + '*-o+[set named option]:option:_options' \ + '*+o+[unset named option]:option:_options' \ + '(1 -s --shinstdin)'{-s,--shinstdin}'[read commands from standard input]' \ + '(-)-b[end of option processing, like --]' \ + '(1 -)-c[run a command]:command:_cmdstring' \ + '(-)1:script file:_files' \ + '*::script arguments:->args' -- && return 0 + +case $state in + (args) + if [[ -n ${opt_args[(I)-c|-s|--shinstdin]} ]]; then + _files + else + _normal + fi + ;; +esac |