[systemd-devel] [PATCH 2/2] zsh-completion: Function declarations follow style

William Giokas 1007380 at gmail.com
Mon Nov 11 09:17:47 PST 2013


Follow the instructions in CODING_STYLE for the zsh completion
functions.
---
 shell-completion/zsh/_hostnamectl         |  3 ++-
 shell-completion/zsh/_journalctl          | 12 ++++++++----
 shell-completion/zsh/_kernel-install      |  6 ++++--
 shell-completion/zsh/_localectl           | 12 ++++++++----
 shell-completion/zsh/_sd_machines         |  3 ++-
 shell-completion/zsh/_systemctl           |  9 ++++++---
 shell-completion/zsh/_systemd-analyze     |  6 ++++--
 shell-completion/zsh/_systemd-coredumpctl |  3 ++-
 shell-completion/zsh/_systemd-delta       |  3 ++-
 shell-completion/zsh/_systemd-inhibit     |  6 ++++--
 shell-completion/zsh/_systemd-nspawn      |  3 ++-
 shell-completion/zsh/_systemd-run         |  9 ++++++---
 shell-completion/zsh/_timedatectl         | 15 ++++++++++-----
 shell-completion/zsh/_udevadm             | 27 ++++++++++++++++++---------
 14 files changed, 78 insertions(+), 39 deletions(-)

diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl
index 7d7baeb..c7a5ec0 100644
--- a/shell-completion/zsh/_hostnamectl
+++ b/shell-completion/zsh/_hostnamectl
@@ -1,6 +1,7 @@
 #compdef hostnamectl
 
-_hostnamectl_command() {
+_hostnamectl_command()
+{
         local -a _hostnamectl_cmds
         _hostnamectl_cmds=(
                 "status:Show current hostname settings"
diff --git a/shell-completion/zsh/_journalctl b/shell-completion/zsh/_journalctl
index b518e35..fcb7874 100644
--- a/shell-completion/zsh/_journalctl
+++ b/shell-completion/zsh/_journalctl
@@ -1,6 +1,7 @@
 #compdef journalctl
 
-_list_fields() {
+_list_fields()
+{
         local -a journal_fields
         journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
                         ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
@@ -20,7 +21,8 @@ _list_fields() {
         esac
 }
 
-_journal_none() {
+_journal_none()
+{
         local -a _commands _files _jrnl_none
         # Setting use-cache will slow this down considerably
         _commands=( ${"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
@@ -31,7 +33,8 @@ _journal_none() {
                 'fields:fields:_list_fields'
 }
 
-_journal_fields() {
+_journal_fields()
+{
         local -a _fields cmd
         cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )
         _fields=( ${(f)"$(_call_program fields $cmd[@])"} )
@@ -39,7 +42,8 @@ _journal_fields() {
         _describe 'possible values' _fields
 }
 
-_journal_boots() {
+_journal_boots()
+{
         local -a _bootid _previousboots
         _bootid=( ${(fao)"$(_call_program bootid "$service -F _BOOT_ID")"}  )
         _previousboots=( -{1..${#_bootid}} )
diff --git a/shell-completion/zsh/_kernel-install b/shell-completion/zsh/_kernel-install
index 3bc29fd..2f1adb5 100644
--- a/shell-completion/zsh/_kernel-install
+++ b/shell-completion/zsh/_kernel-install
@@ -1,6 +1,7 @@
 #compdef kernel-install
 
-_images(){
+_images()
+{
         if [[ "$words[2]" == "remove" ]]; then
                 _message 'No more options'
         else
@@ -8,7 +9,8 @@ _images(){
         fi
 }
 
-_kernels(){
+_kernels()
+{
         read _MACHINE_ID < /etc/machine-id
         _kernel=( /lib/modules/[0-9]* )
         if [[ "$cmd" == "remove" && -n "$_MACHINE_ID" ]]; then
diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl
index 1e3cf03..b94c9d3 100644
--- a/shell-completion/zsh/_localectl
+++ b/shell-completion/zsh/_localectl
@@ -1,6 +1,7 @@
 #compdef localectl
 
-_localectl_set-locale() {
+_localectl_set-locale()
+{
         local -a _confs _locales
         local expl suf
         _locales=( ${(f)"$(_call_program locales "$service" list-locales)"} )
@@ -15,7 +16,8 @@ _localectl_set-locale() {
         fi
 }
 
-_localectl_set-keymap() {
+_localectl_set-keymap()
+{
         local -a _keymaps
         _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} )
         if (( CURRENT <= 3 )); then
@@ -25,7 +27,8 @@ _localectl_set-keymap() {
         fi
 }
 
-_localectl_set-x11-keymap() {
+_localectl_set-x11-keymap()
+{
         if (( $+commands[pkg-config] )); then
                 local -a _file _layout _model _variant _options
                 local _xorg_lst
@@ -50,7 +53,8 @@ _localectl_set-x11-keymap() {
         fi
 }
 
-_localectl_command() {
+_localectl_command()
+{
         local -a _localectl_cmds
         _localectl_cmds=(
                 'status:Show current locale settings'
diff --git a/shell-completion/zsh/_sd_machines b/shell-completion/zsh/_sd_machines
index df2f462..e2e5c04 100644
--- a/shell-completion/zsh/_sd_machines
+++ b/shell-completion/zsh/_sd_machines
@@ -1,5 +1,6 @@
 #autoload
-__get_machines () {
+__get_machines()
+{
         machinectl --full --no-pager list | {while read -r a b; do echo $a; done;};
 }
 
diff --git a/shell-completion/zsh/_systemctl b/shell-completion/zsh/_systemctl
index 133a550..1ab66ce 100644
--- a/shell-completion/zsh/_systemctl
+++ b/shell-completion/zsh/_systemctl
@@ -121,7 +121,8 @@ _systemctl_really_all_units()
         fi
 }
 
-_filter_units_by_property() {
+_filter_units_by_property()
+{
         local property=$1 value=$2 ; shift ; shift
         local -a units ; units=($*)
         local prop unit
@@ -289,13 +290,15 @@ _systemctl_caching_policy()
         return 1
 }
 
-_unit_states() {
+_unit_states()
+{
         local -a _states
         _states=(loaded failed active inactive not-found listening running waiting plugged mounted exited dead masked)
         _values -s , "${_states[@]}"
 }
 
-_unit_types() {
+_unit_types()
+{
         local -a _types
         _types=(automount device mount path service snapshot socket swap target timer)
         _values -s , "${_types[@]}"
diff --git a/shell-completion/zsh/_systemd-analyze b/shell-completion/zsh/_systemd-analyze
index 6242e4f..1acd329 100644
--- a/shell-completion/zsh/_systemd-analyze
+++ b/shell-completion/zsh/_systemd-analyze
@@ -1,12 +1,14 @@
 #compdef systemd-analyze
 
-_systemd_analyze_set-log-level() {
+_systemd_analyze_set-log-level()
+{
         local -a _levels
         _levels=(debug info notice warning err crit alert emerg)
         _describe -t level 'logging level' _levels || compadd "$@"
 }
 
-_systemd_analyze_command(){
+_systemd_analyze_command()
+{
         local -a _systemd_analyze_cmds
         # Descriptions taken from systemd-analyze --help.
         _systemd_analyze_cmds=(
diff --git a/shell-completion/zsh/_systemd-coredumpctl b/shell-completion/zsh/_systemd-coredumpctl
index 27ef67b..3ae9754 100644
--- a/shell-completion/zsh/_systemd-coredumpctl
+++ b/shell-completion/zsh/_systemd-coredumpctl
@@ -1,6 +1,7 @@
 #compdef systemd-coredumpctl
 
-_systemd-coredumpctl_command(){
+_systemd-coredumpctl_command()
+{
         local -a _systemd_coredumpctl_cmds
         _systemd_coredumpctl_cmds=(
                         'list:List available coredumps'
diff --git a/shell-completion/zsh/_systemd-delta b/shell-completion/zsh/_systemd-delta
index 1bec5bd..a3e13ca 100644
--- a/shell-completion/zsh/_systemd-delta
+++ b/shell-completion/zsh/_systemd-delta
@@ -1,6 +1,7 @@
 #compdef systemd-delta
 
-_delta_type() {
+_delta_type()
+{
         local -a _delta_types
         _delta_types=(masked equivalent redirected overridden unchanged)
         _values -s , "${_delta_types[@]}"
diff --git a/shell-completion/zsh/_systemd-inhibit b/shell-completion/zsh/_systemd-inhibit
index 088508c..04ed4bd 100644
--- a/shell-completion/zsh/_systemd-inhibit
+++ b/shell-completion/zsh/_systemd-inhibit
@@ -1,6 +1,7 @@
 #compdef systemd-inhibit
 
-_systemd_inhibit_command(){
+_systemd_inhibit_command()
+{
         if (( CURRENT == 1 )); then
                 compset -q
                 _normal
@@ -16,7 +17,8 @@ _systemd_inhibit_command(){
         fi
 }
 
-_inhibit_what() {
+_inhibit_what()
+{
         local _inhibit
         _inhibit=(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)
         _values -s : "${_inhibit[@]}"
diff --git a/shell-completion/zsh/_systemd-nspawn b/shell-completion/zsh/_systemd-nspawn
index 998b5de..faac8a6 100644
--- a/shell-completion/zsh/_systemd-nspawn
+++ b/shell-completion/zsh/_systemd-nspawn
@@ -1,6 +1,7 @@
 #compdef systemd-nspawn
 
-_nspawn-caps(){
+_nspawn-caps()
+{
         local -a _caps
         _caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
                 CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE
diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run
index b2697ff..a832efd 100644
--- a/shell-completion/zsh/_systemd-run
+++ b/shell-completion/zsh/_systemd-run
@@ -1,17 +1,20 @@
 #compdef systemd-run
 
-__systemctl() {
+__systemctl()
+{
         local -a _modes
         _modes=("--user" "--system")
         systemctl ${words:*_modes} --full --no-legend --no-pager "$@" 2>/dev/null
 }
 
-__get_slices () {
+__get_slices()
+{
         __systemctl list-units --all -t slice \
         | { while read -r a b; do echo $a; done; };
 }
 
-__slices () {
+__slices()
+{
         local -a _slices
         _slices=(${(fo)"$(__get_slices)"})
         typeset -U _slices
diff --git a/shell-completion/zsh/_timedatectl b/shell-completion/zsh/_timedatectl
index 2962ff7..6b29700 100644
--- a/shell-completion/zsh/_timedatectl
+++ b/shell-completion/zsh/_timedatectl
@@ -1,16 +1,19 @@
 #compdef timedatectl
 
-_timedatectl_set-timezone(){
+_timedatectl_set-timezone()
+{
         local -a _timezones
         _timezones=( ${(f)"$(_call_program timezones "${service}" list-timezones)"} )
         compadd "$_timezones[@]"
 }
 
-_timedatectl_set-time(){
+_timedatectl_set-time()
+{
         _message "YYYY-MM-DD HH:MM:SS"
 }
 
-_timedatectl_set-local-rtc(){
+_timedatectl_set-local-rtc()
+{
         local -a _options
         _options=(
                 '0:Maintain RTC in universal time'
@@ -19,7 +22,8 @@ _timedatectl_set-local-rtc(){
         _describe options _options
 }
 
-_timedatectl_set-ntp(){
+_timedatectl_set-ntp()
+{
         local -a _options
         _options=(
                 '0:Disable NTP based network time configuration'
@@ -28,7 +32,8 @@ _timedatectl_set-ntp(){
         _describe options _options
 }
 
-_timedatectl_command(){
+_timedatectl_command()
+{
         local -a _timedatectl_cmds
         _timedatectl_cmds=(
                 'status:Show current time settings'
diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm
index 544cf3c..7284fa2 100644
--- a/shell-completion/zsh/_udevadm
+++ b/shell-completion/zsh/_udevadm
@@ -1,6 +1,7 @@
 #compdef udevadm
 
-_udevadm_info(){
+_udevadm_info()
+{
         _arguments \
                 '--query=[Query the database for specified type of device data. It needs the --path or --name to identify the specified device.]:type:(name symlink path property all)' \
                 '--path=[The devpath of the device to query.]:sys files:_files -P /sys/ -W /sys' \
@@ -14,7 +15,8 @@ _udevadm_info(){
                 '--cleanup-db[Cleanup the udev database.]'
 }
 
-_udevadm_trigger(){
+_udevadm_trigger()
+{
         _arguments \
                 '--verbose[Print the list of devices which will be triggered.]' \
                 '--dry-run[Do not actually trigger the event.]' \
@@ -30,7 +32,8 @@ _udevadm_trigger(){
                 '--parent-match=[Trigger events for all children of a given device.]'
 }
 
-_udevadm_settle(){
+_udevadm_settle()
+{
         _arguments \
                 '--timeout=[Maximum number of seconds to wait for the event queue to become empty.]' \
                 '--seq-start=[Wait only for events after the given sequence number.]' \
@@ -40,7 +43,8 @@ _udevadm_settle(){
                 '--help[Print help text.]'
 }
 
-_udevadm_control(){
+_udevadm_control()
+{
         _arguments \
                 '--exit[Signal and wait for systemd-udevd to exit.]' \
                 '--log-priority=[Set the internal log level of systemd-udevd.]:priorities:(err info debug)' \
@@ -53,7 +57,8 @@ _udevadm_control(){
                 '--help[Print help text.]'
 }
 
-_udevadm_monitor(){
+_udevadm_monitor()
+{
         _arguments \
                 '--kernel[Print the kernel uevents.]' \
                 '--udev[Print the udev event after the rule processing.]' \
@@ -63,7 +68,8 @@ _udevadm_monitor(){
                 '--help[Print help text.]'
 }
 
-_udevadm_test(){
+_udevadm_test()
+{
         _arguments \
                 '--action=[The action string.]:actions:(add change remove)' \
                 '--subsystem=[The subsystem string.]' \
@@ -71,7 +77,8 @@ _udevadm_test(){
                 '*::devpath:_files -P /sys/ -W /sys'
 }
 
-_udevadm_test-builtin(){
+_udevadm_test-builtin()
+{
         if (( CURRENT == 2 )); then
         _arguments \
                 '--help[Print help text]' \
@@ -86,7 +93,8 @@ _udevadm_test-builtin(){
         fi
 }
 
-_udevadm_mounts(){
+_udevadm_mounts()
+{
         local dev_tmp dpath_tmp mp_tmp mline
 
         tmp=( "${(@f)$(< /etc/mtab)}" )
@@ -104,7 +112,8 @@ _udevadm_mounts(){
 }
 
 
-_udevadm_command(){
+_udevadm_command()
+{
         local -a _udevadm_cmds
         _udevadm_cmds=(
                 'info:query sysfs or the udev database'
-- 
1.8.5.rc0



More information about the systemd-devel mailing list