chiark / gitweb /
zsh_completion: Fix single letter args
authorWilliam Giokas <1007380@gmail.com>
Wed, 21 Aug 2013 03:06:54 +0000 (22:06 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 23 Aug 2013 16:48:14 +0000 (12:48 -0400)
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.

shell-completion/zsh/_hostnamectl
shell-completion/zsh/_journalctl
shell-completion/zsh/_localectl
shell-completion/zsh/_loginctl
shell-completion/zsh/_machinectl
shell-completion/zsh/_systemctl
shell-completion/zsh/_systemd
shell-completion/zsh/_systemd-coredumpctl
shell-completion/zsh/_systemd-delta
shell-completion/zsh/_systemd-nspawn
shell-completion/zsh/_timedatectl

index 9d01495ea5c55da398cdbfaaddae66d03ee4ec6d..45b9597897c9fa0234e956b9424b528815fe6be7 100644 (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'
index 212bfdbc2a8426c61dce48ca20ddc776649e2254..7c5cc13bf0c8692a4e5b37dcdaf2b408935d24af 100644 (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]' \
index 321e418b5089841ee37fcd5db642b67417faac32..3d76bb0c4d5c5e32ad84722d37387211455662d8 100644 (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'
index 6d88685ed52f839016c1c78898c12c71d9e17ff1..ebf6b3ae0a90fbc9ccc5dc12429c8e8f0fdc794d 100644 (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'
index abdf46fa44caa4b2d20c65e8b819fb6b78903e7a..2e5e05cfcc25f3be693da0e5556c8ae3b9335c31 100644 (file)
 _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'
index cc2df3c828626809c1a9cd622c7a27ce595e11b8..3d5f2ffeeb1c6e50ec35fa78fd9a517ce5db162d 100644 (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'
index e954c3e65317843f258847245d55b926c49d0de4..06f03bd1e7fa9500acd65df1d1f1357412240e35 100644 (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]'
     ;;
index 1c67500d9666dc0e0eb97a45d95044351dcf7ebd..159e8ee0e206146ff47f05ce906ddb876cc251cd 100644 (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]' \
index 6abb6fc2177fea1f1ee662464666f2d5650b30f4..757f1b66fbd03c3bffd20598827ec0233dd68457 100644 (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)'
index a5f345ea2c881b37cd3c7e807af141770e9953c7..a8c2411f2fc72a7bddada372d424aa1f4d54b4f5 100644 (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' \
index 9e24b860801df073c76ab7c38acbca512cd208ba..987c2de88d5117017fbebeeb73cbb6698e8dd130 100644 (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'