From 862f4963c6f7778cea9e715eeb11ea959eba6db3 Mon Sep 17 00:00:00 2001 From: William Giokas <1007380@gmail.com> Date: Tue, 20 Aug 2013 22:06:54 -0500 Subject: [PATCH] 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 ` 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. --- shell-completion/zsh/_hostnamectl | 2 +- shell-completion/zsh/_journalctl | 14 +++++++------- shell-completion/zsh/_localectl | 2 +- shell-completion/zsh/_loginctl | 6 +++--- shell-completion/zsh/_machinectl | 6 +++--- shell-completion/zsh/_systemctl | 12 ++++++------ shell-completion/zsh/_systemd | 8 ++++---- shell-completion/zsh/_systemd-coredumpctl | 4 ++-- shell-completion/zsh/_systemd-delta | 2 +- shell-completion/zsh/_systemd-nspawn | 8 ++++---- shell-completion/zsh/_timedatectl | 2 +- 11 files changed, 33 insertions(+), 33 deletions(-) diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl index 9d01495ea..45b959789 100644 --- a/shell-completion/zsh/_hostnamectl +++ b/shell-completion/zsh/_hostnamectl @@ -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' diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl index 212bfdbc2..7c5cc13bf 100644 --- a/shell-completion/zsh/_journalctl +++ b/shell-completion/zsh/_journalctl @@ -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]' \ diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 321e418b5..3d76bb0c4 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -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' diff --git a/shell-completion/zsh/_loginctl b/shell-completion/zsh/_loginctl index 6d88685ed..ebf6b3ae0 100644 --- a/shell-completion/zsh/_loginctl +++ b/shell-completion/zsh/_loginctl @@ -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' diff --git a/shell-completion/zsh/_machinectl b/shell-completion/zsh/_machinectl index abdf46fa4..2e5e05cfc 100644 --- a/shell-completion/zsh/_machinectl +++ b/shell-completion/zsh/_machinectl @@ -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' diff --git a/shell-completion/zsh/_systemctl b/shell-completion/zsh/_systemctl index cc2df3c82..3d5f2ffee 100644 --- a/shell-completion/zsh/_systemctl +++ b/shell-completion/zsh/_systemctl @@ -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' diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd index e954c3e65..06f03bd1e 100644 --- a/shell-completion/zsh/_systemd +++ b/shell-completion/zsh/_systemd @@ -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]' ;; diff --git a/shell-completion/zsh/_systemd-coredumpctl b/shell-completion/zsh/_systemd-coredumpctl index 1c67500d9..159e8ee0e 100644 --- a/shell-completion/zsh/_systemd-coredumpctl +++ b/shell-completion/zsh/_systemd-coredumpctl @@ -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]' \ diff --git a/shell-completion/zsh/_systemd-delta b/shell-completion/zsh/_systemd-delta index 6abb6fc21..757f1b66f 100644 --- a/shell-completion/zsh/_systemd-delta +++ b/shell-completion/zsh/_systemd-delta @@ -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)' diff --git a/shell-completion/zsh/_systemd-nspawn b/shell-completion/zsh/_systemd-nspawn index a5f345ea2..a8c2411f2 100644 --- a/shell-completion/zsh/_systemd-nspawn +++ b/shell-completion/zsh/_systemd-nspawn @@ -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' \ diff --git a/shell-completion/zsh/_timedatectl b/shell-completion/zsh/_timedatectl index 9e24b8608..987c2de88 100644 --- a/shell-completion/zsh/_timedatectl +++ b/shell-completion/zsh/_timedatectl @@ -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' -- 2.30.2