zsh_completion: Fix single letter args

Things like -n to specify the lines to show with systemctl and
journalctl accepts syntax like:

  journalctl -n4
  systemctl -n14

Previously, typing `-nXX <tab>` where XX is a number, zsh would try to
complete an integer. Now it will see the XX and use the _journalctl_none
completion. This is also how any of the single letter options that take
arguments work as well.
This commit is contained in:
William Giokas
2013-08-23 12:48:14 -04:00
committed by Zbigniew Jędrzejewski-Szmek
parent ea92ae33e0
commit 862f4963c6
11 changed files with 33 additions and 33 deletions
+1 -1
View File
@@ -28,5 +28,5 @@ _arguments -s \
'--static[Only set static hostname]' \
'--pretty[Only set pretty hostname]' \
'--no-ask-password[Do not prompt for password]' \
{-H,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
'*::hostnamectl commands:_hostnamectl_command'
+7 -7
View File
@@ -62,26 +62,26 @@ _arguments -s \
{-a,--all}'[Show all fields, including long and unprintable]' \
{-f,--follow}'[Follow journal]' \
{-e,--pager-end}'[Jump to the end of the journal in the pager]' \
{-n,--lines=}'[Number of journal entries to show]:integer' \
{-n+,--lines=}'[Number of journal entries to show]:integer' \
'--no-tail[Show all lines, even in follow mode]' \
{-r,--reverse}'[Reverse output]' \
{-o,--output=}'[Change journal output mode]:output modes:_outputmodes' \
{-o+,--output=}'[Change journal output mode]:output modes:_outputmodes' \
{-x,--catalog}'[Show explanatory texts with each log line]' \
{-q,--quiet}"[Don't show privilege warning]" \
{-m,--merge}'[Show entries from all available journals]' \
{-b,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \
{-b+,--boot=}'[Show data only from the specified boot or offset]:boot id or offset:_journal_boots' \
{-k,--dmesg}'[Show only kernel messages, Implies -b]' \
{-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
{-u+,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
'--user-unit[Show data only from the specified user session unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
{-p,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
{-c,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
{-p+,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
{-c+,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
'--after-cursor=[Start showing entries from the location in the journal after the cursor]:cursors:_journal_fields __CURSORS' \
'--since=[Start showing entries newer or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
'--until=[Stop showing entries older or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
{-F,--field=}'[List all values a certain field takes]:Fields:_list_fields' \
'--system[Show system and kernel messages]' \
'--user[Show messages from user services]' \
{-D,--directory=}'[Show journal files from directory]:directories:_directories' \
{-D+,--directory=}'[Show journal files from directory]:directories:_directories' \
'--file=[Operate on specified journal files]:file:_files' \
'--root=[Operate on catalog hierarchy under specified directory]:directories:_directories' \
'--new-id128[Generate a new 128 Bit ID]' \
+1 -1
View File
@@ -79,5 +79,5 @@ _arguments \
"--no-convert[Don't convert keyboard mappings]" \
'--no-pager[Do not pipe output into a pager]' \
'--no-ask-password[Do not prompt for password]' \
{-H,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
'*::localectl commands:_localectl_command'
+3 -3
View File
@@ -95,12 +95,12 @@ done
_arguments -s \
{-h,--help}'[Show help]' \
'--version[Show package version]' \
\*{-p,--property=}'[Show only properties by this name]:unit property' \
\*{-p+,--property=}'[Show only properties by this name]:unit property' \
{-a,--all}'[Show all properties, including empty ones]' \
'--kill-who=[Who to send signal to]:killwho:(main control all)' \
{-s,--signal=}'[Which signal to send]:signal:_signals' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
'--no-ask-password[Do not ask for system passwords]' \
{-H,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-H+,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-P,--privileged}'[Acquire privileges before execution]' \
'--no-pager[Do not pipe output into a pager]' \
'*::loginctl command:_loginctl_command'
+3 -3
View File
@@ -35,13 +35,13 @@
_arguments \
{-h,--help}'[Prints a short help text and exits.]' \
'--version[Prints a short version string and exits.]' \
\*{-p,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
\*{-p+,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
{-a,--all}'[Show all proerties]' \
(-l,--full)'[Do not ellipsize cgroup members]' \
'--no-pager[Do not pipe output into a pager]' \
'--no-ask-password[Do not ask for system passwords]' \
'--kill-who=[Who to send signal to]:killwho:(leader all)' \
{-s,--signal=}'[Which signal to send]:signal:_signals' \
{-H,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-H+,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-P,--privileged}'[Acquire privileges before execution]' \
'*::machinectl command:_machinectl_command'
+6 -6
View File
@@ -309,9 +309,9 @@ _unit_types() {
_arguments -s \
{-h,--help}'[Show help]' \
'--version[Show package version]' \
{-t,--type=}'[List only units of a particular type]:unit type:_unit_types' \
{-t+,--type=}'[List only units of a particular type]:unit type:_unit_types' \
'--state=[Display units in the specifyied state]:unit state:_unit_states' \
\*{-p,--property=}'[Show only properties by specific name]:unit property' \
\*{-p+,--property=}'[Show only properties by specific name]:unit property' \
{-a,--all}'[Show all units/properties, including dead/empty ones]' \
'--reverse[Show reverse dependencies]' \
'--after[Show units ordered after]' \
@@ -334,13 +334,13 @@ _arguments -s \
"--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
'--no-ask-password[Do not ask for system passwords]' \
'--kill-who=[Who to send signal to]:killwho:(main control all)' \
{-s,--signal=}'[Which signal to send]:signal:_signals' \
{-s+,--signal=}'[Which signal to send]:signal:_signals' \
{-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]' \
{-H,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-H+,--host=}'[Show information for remote host]:userathost:_sd_hosts_or_user_at_host' \
{-P,--privileged}'[Acquire privileges before execution]' \
{-n,--lines=}'[Journal entries to show]:number of entries' \
{-o,--output=}'[Change journal output mode]:modes:_outputmodes' \
{-n+,--lines=}'[Journal entries to show]:number of entries' \
{-o+,--output=}'[Change journal output mode]:modes:_outputmodes' \
'--plain[When used with list-dependencies, print output as a list]' \
'*::systemctl command:_systemctl_command'
+4 -4
View File
@@ -15,8 +15,8 @@ case "$service" in
_arguments \
{-h,--help}'[Show this help]' \
'--version[Show package version.]' \
{-t,--identifier=}'[Set syslog identifier.]' \
{-p,--priority=}'[Set priority value.]:value:({0..7})' \
{-t+,--identifier=}'[Set syslog identifier.]' \
{-p+,--priority=}'[Set priority value.]:value:({0..7})' \
'--level-prefix=[Control whether level prefix shall be parsed.]:boolean:(1 0)' \
':Message'
;;
@@ -38,8 +38,8 @@ case "$service" in
'(-m -p -i -t)-c[Order by CPU load]' \
'(-c -p -i -t)-m[Order by memory load]' \
'(-c -m -p -t)-i[Order by IO load]' \
{-d,--delay=}'[Specify delay]' \
{-n,--iterations=}'[Run for N iterations before exiting]' \
{-d+,--delay=}'[Specify delay]' \
{-n+,--iterations=}'[Run for N iterations before exiting]' \
{-b,--batch}'[Run in batch mode, accepting no input]' \
'--depth=[Maximum traversal depth]'
;;
+2 -2
View File
@@ -28,8 +28,8 @@ _systemd-coredumpctl_command(){
}
_arguments \
{-o,--output=}'[Write output to FILE]:output file:_files' \
{-F,--field=}'[Show field in list output]:field' \
{-o+,--output=}'[Write output to FILE]:output file:_files' \
{-F+,--field=}'[Show field in list output]:field' \
'--no-pager[Do not pipe output into a pager]' \
{-h,--help}'[Show this help]' \
'--version[Show package version]' \
+1 -1
View File
@@ -11,5 +11,5 @@ _arguments \
'--version[Show package version]' \
'--no-pager[Do not pipe output into a pager]' \
'--diff=[Show a diff when overridden files differ]:boolean:(1 0)' \
{-t,--type=}'[Only display a selected set of override types]:types:_delta_type' \
{-t+,--type=}'[Only display a selected set of override types]:types:_delta_type' \
':SUFFIX:(tmpfiles.d sysctl.d systemd/system)'
+4 -4
View File
@@ -12,11 +12,11 @@ _nspawn-caps(){
_arguments \
{-h,--help}'[Show this help]' \
{--directory=,-D}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
{--boot,-b}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
{--user=,-u}'[Run the command under specified user, create home directory and cd into it.]' \
{--directory=,-D+}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
{--boot,-b+}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
{--user=,-u+}'[Run the command under specified user, create home directory and cd into it.]' \
'--uuid=[Set the specified uuid for the container.]' \
{--controllers=,-C}'[Makes the container appear in other hierarchies than the name=systemd:/ one. Takes a comma-separated list of controllers.]' \
{--controllers=,-C+}'[Makes the container appear in other hierarchies than the name=systemd:/ one. Takes a comma-separated list of controllers.]' \
'--private-network[Turn off networking in the container. This makes all network interfaces unavailable in the container, with the exception of the loopback device.]' \
'--read-only[Mount the root file system read only for the container.]' \
'--capability=[List one or more additional capabilities to grant the container.]:capabilities:_nspawn-caps' \
+1 -1
View File
@@ -61,5 +61,5 @@ _arguments -s \
'--adjust-system-clock[Adjust system clock when changing local RTC mode]' \
'--no-pager[Do not pipe output into a pager]' \
'--no-ask-password[Do not prompt for password]' \
{-H,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
'*::timedatectl commands:_timedatectl_command'