Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] Completion batch #5: Simple Darwin and Linux utilities
- X-seq: zsh-workers 42231
- From: dana <dana@xxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [PATCH] Completion batch #5: Simple Darwin and Linux utilities
- Date: Fri, 5 Jan 2018 14:26:17 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=0ZPgR8TH+/bkzJxXpUHpOXWxSdvQ6HmIT29WlsMwfs0=; b=pTQYDd3EI0IpIr7Gv8j9iR9ZpqzaSLYFwfYyJgh65UaIYiAD0V18FmjryFz0LmDQcG IuOXTanXlU8mExtZwg+In01MTvMcLDbwIT2vWq90uPhbfXyyDayOjJUK4tXFzHogU0R3 wkN+ZLJwYm/std8zBI54u5N6YdDMSdNxJkRoHCj17IJV8GDnKYv9nK+7J+UNT1XORbcq 0BoAMiOjfcEY6LQti1UTLaLP5sDHxz9FVkSTv6uhmG/ShFCas+UfE7wRiz4+VNfWLJlM cada58gBcT5nwdahXzJ2okeYfQxEmxkjx1hDG8SbVVKjw1uU3ciXHLv7QFMObFroo1+8 AoDg==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
New functions for simple utilities belonging to the 'Darwin' and 'Linux' groups.
Also a small change to an existing function (_attr) to add the Darwin variant.
Hope it's not too many at once; i tried to incorporate Oliver's feedback from
before so it won't need as much editing.
The patches following this one will be more elaborate and/or risky.
dana
diff --git a/Completion/Darwin/Command/_caffeinate b/Completion/Darwin/Command/_caffeinate
new file mode 100644
index 000000000..9e361a5bd
--- /dev/null
+++ b/Completion/Darwin/Command/_caffeinate
@@ -0,0 +1,12 @@
+#compdef caffeinate
+
+_arguments -s -S : \
+ '-d[prevent display sleep]' \
+ '-i[prevent system idle sleep]' \
+ '-m[prevent disk idle sleep]' \
+ '-s[prevent system sleep (AC power only)]' \
+ '-u[declare that user is active]' \
+ '(:)-t[specify assertion timeout value]:timeout (seconds)' \
+ '(:)-w[wait for specified PID]: :_pids' \
+ '(-)1: : _command_names -e' \
+ '(-)*::command argument'
diff --git a/Completion/Darwin/Command/_mdfind b/Completion/Darwin/Command/_mdfind
new file mode 100644
index 000000000..b38b0ee91
--- /dev/null
+++ b/Completion/Darwin/Command/_mdfind
@@ -0,0 +1,29 @@
+#compdef mdfind
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '(-count)-0[separate result paths by NUL]' \
+ '(-0)-count[display count of results instead of paths]' \
+ '(-literal)-interpret[interpret query as if entered in Spotlight search field]' \
+ '(-interpret)-literal[interpret query as literal query string]' \
+ '-live[provide live updates to query results]' \
+ '-onlyin[limit search to specified directory]: :_directories' \
+ '(: -s)*-name[search for files with names matching specified string]:file name string' \
+ '-reprint[reprint -live results on update]' \
+ '(: -name)-s[show contents of specified smart folder]: :->smart-folders' \
+ '(-s -name)1: :_guard "^-*" "query"' \
+&& ret=0
+
+[[ $state == smart-folders ]] && {
+ tmp=( "$HOME/Library/Saved Searches/"*.savedSearch(-.N:r:t) )
+ if (( $#tmp )); then
+ _values 'smart folder' $tmp && ret=0
+ else
+ _message 'smart folder' && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_mdls b/Completion/Darwin/Command/_mdls
new file mode 100644
index 000000000..853cafd08
--- /dev/null
+++ b/Completion/Darwin/Command/_mdls
@@ -0,0 +1,9 @@
+#compdef mdls
+
+# Note: The inconsistent use of the -o+ option variant here is deliberate
+_arguments -s -S : \
+ '*'{-n+,-name}'[restrict output to specified attribute]:attribute' \
+ '(-p -plist)-nullMarker[specify string used for null values]:string' \
+ '(-p -r -nullMarker -plist -raw)'{-p,-plist}'[output in XML plist format to specified file]:output file:_files' \
+ '(-p -r -plist -raw)'{-r,-raw}'[print raw (NUL-delimited) attribute data]' \
+ '*: :_files'
diff --git a/Completion/Darwin/Command/_mdutil b/Completion/Darwin/Command/_mdutil
new file mode 100644
index 000000000..abac690ac
--- /dev/null
+++ b/Completion/Darwin/Command/_mdutil
@@ -0,0 +1,19 @@
+#compdef mdutil
+
+# @todo This isn't fully comprehensive, but it's unclear from the documentation
+# how some of these options are meant to work together or what kind of arguments
+# they expect
+
+local -a volumes=( / /Volumes/*(N) )
+
+_arguments -s -S : \
+ '(-V)-a[apply to all volumes]' \
+ '-d[disable Spotlight activity]' \
+ '-E[erase and rebuild index]' \
+ '-i[toggle indexing status]:indexing status:(on off)' \
+ '-p[publish metadata]' \
+ '-s[print indexing status]' \
+ '(: -)-t[resolve files from specified file ID]:file ID, volume path, or device ID: :file ID' \
+ "(-a)-V[apply to stores on specified volume]:volume:(${(j< >)${(@q-)volumes}})" \
+ '-v[output verbosely]' \
+ "*:volume:(${(j< >)${(@q-)volumes}})"
diff --git a/Completion/Darwin/Command/_nvram b/Completion/Darwin/Command/_nvram
new file mode 100644
index 000000000..8158eb9d2
--- /dev/null
+++ b/Completion/Darwin/Command/_nvram
@@ -0,0 +1,30 @@
+#compdef nvram
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+# Note: -x can only be used with -f/-p, but must be used first to have effect
+_arguments -s : \
+ '(: -)-c[delete all NVRAM variables]' \
+ '(: -)-d[delete specified NVRAM variable]: :->variables-ro' \
+ '(: -)-f[set NVRAM variables from file]: :_files' \
+ '(: -)-p[print all NVRAM variables]' \
+ '(-c -d)-x[use XML format for input and output]' \
+ '(-)*: :->variables-rw' \
+&& ret=0
+
+[[ $state == variables-* ]] && {
+ tmp=( ${${(f)"$( command $service -p )"}%%[[:space:]]*} )
+
+ [[ $state == variables-rw ]] &&
+ tmp=( ${^tmp}'::NVRAM variable value' )
+
+ if (( $#tmp )); then
+ _values -w 'NVRAM variable' $tmp && ret=0
+ else
+ _message 'NVRAM variable' && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_osascript b/Completion/Darwin/Command/_osascript
new file mode 100644
index 000000000..5e4a5f70c
--- /dev/null
+++ b/Completion/Darwin/Command/_osascript
@@ -0,0 +1,34 @@
+#compdef osascript
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '-l+[specify script language]: :->languages' \
+ '(:)*-e+[execute specified line of script]:script' \
+ '-i[run interactively]' \
+ '*-s+[specify output style]: :->modifiers' \
+ '(-e)1:script file:_files' \
+&& ret=0
+
+case $state in
+ languages)
+ # So far, the three languages specified here are the only ones supported,
+ # but adding the output of osalang makes this future-proof
+ _values 'script language' \
+ AppleScript JavaScript 'Generic Scripting System' \
+ ${(f)"$( command osalang 2> /dev/null )"} \
+ && ret=0
+ ;;
+ modifiers)
+ _values -S '' 'output modifier flag' \
+ 'h[print values in human-readable form]' \
+ 's[print values in recompilable source form]' \
+ 'e[print script errors to stderr]' \
+ 'o[print script errors to stdout]' \
+ && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_pbcopy b/Completion/Darwin/Command/_pbcopy
new file mode 100644
index 000000000..fd60f00cc
--- /dev/null
+++ b/Completion/Darwin/Command/_pbcopy
@@ -0,0 +1,30 @@
+#compdef pbcopy pbpaste
+
+local ret=1
+local -a context line state state_descr args
+local -A opt_args val_args
+
+args=(
+ '(-)-help[display help information]'
+ '-pboard[specify pasteboard to copy to or paste from]: :->pboards'
+)
+[[ $service == pbpaste ]] & args+=(
+ '-Prefer[specify type of data to prefer when pasting]: :->dtypes'
+)
+
+_arguments : $args && ret=0
+
+case $state in
+ dtypes)
+ _values 'data type' \
+ 'txt[plain text]' \
+ 'rtf[rich text]' \
+ 'ps[encapsulated PostScript]' \
+ && ret=0
+ ;;
+ pboards)
+ _values pasteboard general ruler find font && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_plutil b/Completion/Darwin/Command/_plutil
new file mode 100644
index 000000000..8138a5c5e
--- /dev/null
+++ b/Completion/Darwin/Command/_plutil
@@ -0,0 +1,53 @@
+#compdef plutil
+
+local ret=1 k v
+local -a context line state state_descr tmp fmts=( xml1 binary1 json )
+local -A opt_args val_args types=(
+ -bool 'boolean'
+ -data 'base64-encoded data'
+ -date 'date (XML property-list format)'
+ -float '64-bit float'
+ -integer '64-bit integer'
+ -json 'JSON fragment'
+ -xml 'XML property list'
+)
+
+_arguments -s -S : \
+ '(: -)-help[display help information]' \
+ '(-p -r)-s[suppress normal output]' \
+ '*:input file:_files' \
+ - set1 \
+ '-lint[check input for syntax errors]' \
+ - set2 \
+ "(-extract -insert -replace -remove)-convert[convert to specified format]:output format:(${(j< >)fmts})" \
+ "(-convert -insert -replace -remove)-extract[extract value at specified key path from property list]: :->k:output format:(${(j< >)fmts})" \
+ '(-convert -extract -replace -remove)-insert[insert value at specified key path into property list]: :->k: :->t: :->v' \
+ '(-convert -extract -insert -remove)-replace[replace value at specified key path in property list]: :->k: :->t: :->v' \
+ '(-convert -extract -insert -replace)-remove[remove value at specified key path from property list]: :->k' \
+ '(-o -extract -insert -replace -remove)-e[specify output file extension]:output file extension' \
+ '(-e -extract -insert -replace -remove)-o[specify output file]:output file:_files' \
+ '(-r -s)-p[pretty-print property list]' \
+ '(-p -s)-r[pretty-print JSON]' \
+&& ret=0
+
+case $state in
+ k) _message 'key path' && ret=0 ;;
+ t)
+ tmp=()
+ for k v in ${(kv)types}; do
+ tmp+=( "${k}[${v}]" )
+ done
+ _values 'value type' $tmp && ret=0
+ ;;
+ v)
+ if [[ $words[(CURRENT - 1)] == -bool ]]; then
+ _values $types[-bool] YES NO true false && ret=0
+ elif (( $+types[$words[(CURRENT - 1)]] )); then
+ _message $types[$words[(CURRENT - 1)]] && ret=0
+ else
+ _message value && ret=0
+ fi
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_say b/Completion/Darwin/Command/_say
new file mode 100644
index 000000000..d687cfa11
--- /dev/null
+++ b/Completion/Darwin/Command/_say
@@ -0,0 +1,85 @@
+#compdef say
+
+local ret=1
+local -a context line state state_descr tmp
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '(-a --audio-device)'{-a+,--audio-device=}'[specify audio device]: :->devices' \
+ '--bit-rate=[specify bit rate]: :->bit-rates' \
+ '--channels=[specify number of channels]:number of channels' \
+ '--data-format=[specify output data format]: :->data-formats' \
+ '(: -f --input-file)'{-f+,--input-file=}'[specify input file]:input file:_files' \
+ '--file-format=[specify output file format]: :->file-formats' \
+ '(-i --interactive)-i[display/highlight text as it is spoken]' \
+ '(-i --interactive)--interactive=[display/highlight text as it is spoken]:: :->markups' \
+ '(-o --output-file)'{-o+,--output-file=}'[specify output file]:output file:_files' \
+ '(-n --network-send)'{-n+,--network-send=}'[specify network service/port]:network service/port' \
+ '--progress[display progress meter]' \
+ '--quality=[specify converter quality level]:quality level (0-127)' \
+ '(-r --rate)'{-r+,--rate=}'[specify speech rate]:speech rate (words per minute)' \
+ '(-v --voice)'{-v+,--voice=}'[specify voice]: :->voices' \
+ '(-f)*: :_guard "^-*" "text to speak"' \
+&& ret=0
+
+case $state in
+ bit-rates)
+ # A file format must have already been provided in order to complete these;
+ # also, not every file format supports bit-rate values
+ (( $+opt_args[--file-format] )) && {
+ tmp=( ${(f)"$(
+ command $service \
+ --file-format=${opt_args[--file-format]##*:} \
+ --bit-rate='?' 2> /dev/null
+ )"} )
+ tmp=( ${tmp//[[:space:]]##/} )
+ }
+ if (( $#tmp )); then
+ _values 'bit rate' $tmp && ret=0
+ else
+ _message 'bit rate' && ret=0
+ fi
+ ;;
+ data-formats)
+ # A file format must have already been provided in order to complete these
+ if (( ! $+opt_args[--file-format] )); then
+ _message 'data format' && ret=0
+ else
+ tmp=( ${(f)"$(
+ command $service \
+ --file-format=${opt_args[--file-format]##*:} \
+ --data-format='?' 2> /dev/null
+ )"} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${^tmp/[[:space:]]##/[}\] )
+ _values 'data format' $tmp && ret=0
+ fi
+ ;;
+ devices)
+ tmp=( ${(f)"$( command $service -a '?' 2> /dev/null )"} )
+ tmp=( ${tmp##[[:space:]]#[0-9]##[[:space:]]##} )
+ tmp=( ${tmp//:/\\:} )
+ _values 'audio device name or ID' $tmp && ret=0
+ ;;
+ file-formats)
+ tmp=( ${(f)"$( command $service --file-format='?' 2> /dev/null )"} )
+ tmp=( ${tmp%%[[:space:]]##\(.*} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${^tmp/[[:space:]]##/[}\] )
+ _values 'file format' $tmp && ret=0
+ ;;
+ markups)
+ tmp=( bold smso smul ${(k)terminfo} )
+ _alternative \
+ 'colors:color:(black red green yellow blue magenta cyan white)' \
+ "capabilities:terminfo capability:( ${(j< >)tmp} )" \
+ && ret=0
+ ;;
+ voices)
+ tmp=( ${(f)"$( command $service -v '?' 2> /dev/null )"} )
+ tmp=( ${tmp%%[[:space:]](#c2,)*} )
+ _values voice $tmp && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_scselect b/Completion/Darwin/Command/_scselect
new file mode 100644
index 000000000..79df2f981
--- /dev/null
+++ b/Completion/Darwin/Command/_scselect
@@ -0,0 +1,39 @@
+#compdef scselect
+
+local ret=1 u l
+local -a context line state state_descr tmp loc1 loc2
+local -A opt_args
+
+_arguments -s -S : \
+ '-n[delay changing until next boot]' \
+ '1: :->locations' \
+&& ret=0
+
+[[ $state == locations ]] && {
+ # For some reason scselect expects location names to be encoded in Mac OS
+ # Roman; in order to prevent completed arguments from breaking the tool, we'll
+ # insert the UUID instead if the name would contain incompatible characters
+ tmp=( ${(f)"$( command $service 2> /dev/null )"} )
+ tmp=( ${tmp[2,-1]} )
+ tmp=( ${tmp##[*[:space:]]##} )
+ tmp=( ${tmp//:/\\:} )
+ tmp=( ${tmp/[[:space:]]##\(/$'\0'} )
+ tmp=( ${tmp%\)} )
+
+ for u l in "${(@0)tmp}"; do
+ loc1+=( "${l}:${u}" )
+ if [[ $l == [[:ascii:]]## ]]; then
+ loc2+=( $l )
+ else
+ loc2+=( $u )
+ fi
+ done
+
+ if (( $#loc1 )); then
+ _describe location loc1 loc2 && ret=0
+ else
+ _message location && ret=0
+ fi
+}
+
+return ret
diff --git a/Completion/Darwin/Command/_scutil b/Completion/Darwin/Command/_scutil
new file mode 100644
index 000000000..6c0a84d64
--- /dev/null
+++ b/Completion/Darwin/Command/_scutil
@@ -0,0 +1,56 @@
+#compdef scutil
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args val_args
+
+# Don't complete host names unless we have -r (this is weird, but the obvious
+# alternative (exclusion sets) currently doesn't work properly with option
+# stacking)
+(( ! $words[(I)-*] || ($words[(I)-W] && ! $words[(I)-r]) )) &&
+: ${PREFIX:=-}
+
+# @todo We could complete nc-cmd arguments better if we wanted to
+_arguments -s -S -A '-*' : \
+ + '(g1)' \
+ '(: -)--dns[display current DNS configuration]' \
+ '(: -)--get[display specified preference]: :->prefs' \
+ '(: -)--nc[interact with VPN connections]: :->nc-cmd:*:argument' \
+ '(: -)--prefs[interface with raw preference data]:preference file:_files' \
+ '(: -)--proxy[display current proxy configuration]' \
+ '(: -)--set[set specified preference]: :->prefs:value' \
+ + g2 \
+ '(g1 g3)-r[check network reachability]' \
+ '(g1 g3)-W[monitor (watch) network reachability]' \
+ '(g1 g3)1:host:_hosts' \
+ '(g1 g3)2::host:_hosts' \
+ + g3 \
+ '(g1 g2)-w[wait for key to exist in dynamic store]' \
+ '(g1 g2)-t+[specify timeout]:timeout (seconds)' \
+&& ret=0
+
+case $state in
+ nc-cmd)
+ _values command \
+ 'disablevpn[disable specified service or VPN application type]' \
+ 'enablevpn[enable specified service or VPN application type]' \
+ 'help[display command help]' \
+ 'list[list services]' \
+ 'ondemand[display VPN on-demand information]' \
+ 'resume[resume specified service]' \
+ 'select[make specified service active]' \
+ 'show[display configuration information for specified service]' \
+ 'start[start specified service]' \
+ 'statistics[display statistics for specified service]' \
+ 'status[display status for specified service]' \
+ 'stop[stop specified service]' \
+ 'suspend[suspend specified service]' \
+ 'trigger[trigger VPN on-demand with specified host]' \
+ && ret=0
+ ;;
+ prefs)
+ _values preference ComputerName HostName LocalHostName && ret=0
+ ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_sw_vers b/Completion/Darwin/Command/_sw_vers
new file mode 100644
index 000000000..11814e0b0
--- /dev/null
+++ b/Completion/Darwin/Command/_sw_vers
@@ -0,0 +1,6 @@
+#compdef sw_vers
+
+_arguments : \
+ '(-)-buildVersion[display build version only]' \
+ '(-)-productName[display product name only]' \
+ '(-)-productVersion[display product version only]'
diff --git a/Completion/Linux/Command/_chattr b/Completion/Linux/Command/_chattr
new file mode 100644
index 000000000..bf46d8b89
--- /dev/null
+++ b/Completion/Linux/Command/_chattr
@@ -0,0 +1,42 @@
+#compdef chattr
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args val_args
+
+_arguments -s -S : \
+ '-f[suppress most error messages]' \
+ "-p+[set file's project number]:project number" \
+ '-R[act recursively]' \
+ '-V[output verbosely]' \
+ "-v+[set file's version/generation number]:version/generation number" \
+ '1: :->attrs' \
+ '*: :_files' \
+&& ret=0
+
+[[ $state == attrs ]] &&
+if compset -P '*[=+-]'; then
+ # These modes can't be changed with chattr: [EhINXZ]
+ _values -S '' attribute \
+ 'A[no atime updates]' \
+ 'a[append only]' \
+ 'C[no copy on write]' \
+ 'c[compressed]' \
+ 'D[no synchronous directory updates]' \
+ 'd[no dump]' \
+ 'e[extent format]' \
+ 'i[immutable]' \
+ 'j[data journalling]' \
+ 'P[project hierarchy]' \
+ 'S[synchronous updates]' \
+ 's[secure deletion]' \
+ 'T[top of directory hierarchy]' \
+ 't[no tail-merging]' \
+ 'u[undeletable]' \
+ && ret=0
+else
+ compset -P '*'
+ _values -S '' operator = + - && ret=0
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_ldconfig b/Completion/Linux/Command/_ldconfig
new file mode 100644
index 000000000..5f4802f91
--- /dev/null
+++ b/Completion/Linux/Command/_ldconfig
@@ -0,0 +1,35 @@
+#compdef ldconfig ldconfig.real
+
+local ret=1
+local -a context line state state_descr
+local -A opt_args
+
+_arguments -s -S : \
+ '(x -v --verbose)'{-v,--verbose}'[output verbosely]' \
+ '(x)*: :->files' \
+ + x \
+ '(: -)'{-\?,--help}'[display help information]' \
+ '(: -)'{-p,--print-cache}'[display libraries in current cache]' \
+ '(: -)--usage[display brief usage information]' \
+ '(: -)'{-V,--version}'[display version information]' \
+ + l \
+ '(x o)-l[manually link individual libraries (library mode)]' \
+ + o \
+ '(x l -c --format)'{-c+,--format=}'[specify cache format]:cache format:(old new compat)' \
+ '(x l)-C+[specify cache file to use instead of /etc/ld.so.cache]:cache file:_files' \
+ '(x l)-f+[specify configuration file to use instead of /etc/ld.so.conf]:configuration file:_files' \
+ '(x l -i --ignore-aux-cache)'{-i,--ignore-aux-cache}'[ignore auxiliary cache file]' \
+ '(x l -N)-n[process only directories specified on command line (implies -N)]' \
+ '(x l)-N[do not rebuild cache]' \
+ '(x l)-r+[specify root directory]:root directory:_directories' \
+ '(x l)-X[do not update symbolic links]' \
+&& ret=0
+
+[[ $state == files ]] &&
+if [[ -n ${opt_args[(I)l--l]} ]]; then
+ _object_files && ret=0
+else
+ _directories && ret=0
+fi
+
+return ret
diff --git a/Completion/Linux/Command/_ldd b/Completion/Linux/Command/_ldd
new file mode 100644
index 000000000..a2db8fa91
--- /dev/null
+++ b/Completion/Linux/Command/_ldd
@@ -0,0 +1,11 @@
+#compdef ldd
+
+# ldd seems like it should support option stacking... but it does not
+_arguments -A '-*' -S : \
+ '(-d -r --data-relocs --function-relocs)'{-d,--data-relocs}'[process data relocations]' \
+ '(: -)--help[display help information]' \
+ '(-d -r --data-relocs --function-relocs)'{-r,--function-relocs}'[process data and function relocations]' \
+ '(-u --unused)'{-u,--unused}'[display unused direct dependencies]' \
+ '(-v --verbose)'{-v,--verbose}'[output verbosely]' \
+ '(: -)--version[display version information]' \
+ '(x)*:object file:_object_files'
diff --git a/Completion/Linux/Command/_lsattr b/Completion/Linux/Command/_lsattr
new file mode 100644
index 000000000..def0bd3d9
--- /dev/null
+++ b/Completion/Linux/Command/_lsattr
@@ -0,0 +1,11 @@
+#compdef lsattr
+
+_arguments -s -S : \
+ '-a[show all files, including hidden ones]' \
+ '-d[list directory entries instead of contents]' \
+ '-l[use long option names]' \
+ "-p[show file's project number]" \
+ '-R[act recursively]' \
+ '-V[display version information]' \
+ "-v[show file's version/generation number]" \
+ '*: :_files'
diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr
index df1fb7da4..2030064dc 100644
--- a/Completion/Unix/Command/_attr
+++ b/Completion/Unix/Command/_attr
@@ -1,4 +1,4 @@
-#compdef attr getfattr setfattr
+#compdef attr getfattr setfattr xattr
case $service in
attr)
@@ -45,4 +45,23 @@ case $service in
'*:file:_files'
return
;;
+ # The Python xattr module ships with a utility called xattr which might appear
+ # on some systems; it is not entirely compatible with the Darwin variant, but
+ # does seem inspired by it, to the degree that this is probably close enough
+ xattr)
+ _arguments -s -S -A '-*' : \
+ '(: -)'{-h,--help}'[display help information]' \
+ '(-c -d -w)-l[display in long format]' \
+ '-r[act recursively]' \
+ '-s[act on symbolic links]' \
+ '(-w)-v[always display file name]' \
+ '(-c -d)-x[use hexademical format for value input and output]' \
+ '*: :_files' \
+ + '(op)' \
+ '(-l -x)-c[remove all attributes]' \
+ '(-l -x)-d[remove specified attribute]:attribute name' \
+ '-p[display value of specified attribute]:attribute name' \
+ '(-l -v)-w[set value of specified attribute]:attribute name: :attribute value'
+ return
+ ;;
esac
Messages sorted by:
Reverse Date,
Date,
Thread,
Author