From 20423a74f8d278d8e8ad23f73424b341097efb9c Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 26 Oct 2025 16:00:38 +0900 Subject: [PATCH 1/4] add lsipc completion --- src/_lsipc | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 src/_lsipc diff --git a/src/_lsipc b/src/_lsipc new file mode 100644 index 0000000..a7da0d4 --- /dev/null +++ b/src/_lsipc @@ -0,0 +1,125 @@ +#compdef lsipc +# ------------------------------------------------------------------------------ +# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for lsipc v2.41 (https://github.com/util-linux/util-linux) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +(( $+functions[_lsipc_output_columns] )) || +_lsipc_output_columns() { + local -a columns=( + "ID[Resource ID]" + "OWNER[Owner's username or UID]" + "PERMS[Permissions]" + "CUID[Creator UID]" + "CUSER[Creator user]" + "CGID[Creator GID]" + "CGROUP[Creator group]" + "UID[User ID]" + "USER[User name]" + "GID[Group ID]" + "GROUP[Group name]" + "CTIME[Time of the last change]" + + # Generic POSIX columns: + "NAME[POSIX resource name]" + "MTIME[Time of last action]" + + # System V Shared-memory columns (--shmems): + "SIZE[Segment size]" + "NATTCH[Number of attached processes]" + "STATUS[Status]" + "ATTACH[Attach time]" + "DETACH[Detach time]" + "COMMAND[Creator command line]" + "CPID[PID of the creator]" + "LPID[PID of last user]" + + # System V Message-queue columns (--queues): + "USEDBYTES[Bytes used]" + "MSGS[Number of messages]" + "SEND[Time of last msg sent]" + "RECV[Time of last msg received]" + "LSPID[PID of the last msg sender]" + "LRPID[PID of the last msg receiver]" + + # System V Semaphore columns (--semaphores): + "NSEMS[Number of semaphores]" + "OTIME[Time of the last operation]" + + # POSIX Semaphore columns (--posix-semaphores): + "SVAL[Semaphore value]" + + # Summary columns (--global): + "RESOURCE[Resource name]" + "DESCRIPTION[Resource description]" + "LIMIT[System-wide limit]" + "USED[Currently used]" + "USE%[Currently use percentage]" + ) + + _values -s ',' column $columns +} + +_arguments \ + '(- *)'{-h,--help}'[display this help]' \ + '(- *)'{-V,--version}'[display version]' \ + '(-m --shmems)'{-m,--shmems}'[shared memory segments]' \ + '(-M --posix-shmems)'{-M,--posix-shmems}'[POSIX shared memory segments]' \ + '(-q --queues)'{-q,--queues}'[POSIX shared memory segments]' \ + '(-Q --posix-mqueues)'{-Q,--posix-mqueues}'[POSIX message queues]' \ + '(-s --semaphores)'{-s,--semaphores}'[semaphores]' \ + '(-S --posix-semaphores)'{-S,--posix-semaphores}'[POSIX semaphores]' \ + '(-g --global)'{-g,--global}'[info about system-wide usage]' \ + \*{-i,--id}'[System V resource identified by id]:id' \ + \*{-N,--name}'[POSIX resource identified by name]:name' \ + '--noheadings[do not print headings]' \ + '--notruncate[do not truncate output]' \ + '(-b --bytes)'{-b,--bytes}'[print SIZE in bytes rather]' \ + '(-c --creator)'{-c,--creator}'[show creator and owner]' \ + '(-e --export)'{-e,--export}'[display in the export-able output format]' \ + '(-J --json)'{-J,--json}'[use the JSON output format]' \ + '(-n --newline)'{-n,--newline}'[display each piece of information on a new line]' \ + '(-l --list)'{-l,--list}'[force list output format]' \ + '(-o --output)'{-o,--output=-}'[define the columns to output]:columns:_lsipc_output_columns' \ + '(-P --numeric-perms)'{-p,--numeric-perms}'[print numeric permissions]' \ + '(-r --raw)'{-r,--raw}'[display in raw mode]' \ + '(-t --time)'{-t,--time}'[show attach, detach and change times]' \ + '(-y --shell)'{-y,--shell}'[use column names to be usable as shell variables]' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From 215780cd9c9098a215bce2a169a521e950a0f9db Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 26 Oct 2025 16:11:16 +0900 Subject: [PATCH 2/4] add lslocks completion --- src/_lslocks | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/_lslocks diff --git a/src/_lslocks b/src/_lslocks new file mode 100644 index 0000000..cec8c43 --- /dev/null +++ b/src/_lslocks @@ -0,0 +1,77 @@ +#compdef lslocks +# ------------------------------------------------------------------------------ +# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for lslocks v2.41 (https://github.com/util-linux/util-linux) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +(( $+functions[_lslocks_output_columns] )) || +_lslocks_output_columns() { + local -a columns=( + "COMMAND[command of the process holding the lock]" + "PID[PID of the process holding the lock]" + "TYPE[kind of lock]" + "SIZE[size of the locks]" + "INODE[inode number]" + "MAJ\\:MIN[major:minor device number]" + "MODE[lock access mode]" + "M[mandatory state of the lock: 0 (none), 1 (set)]" + "START[relative byte offset of the lock]" + "END[ending offset of the lock]" + "PATH[path of the locked file]" + "BLOCKER[PID of the process blocking the lock]" + "HOLDERS[holders of the lock]" + ) + + _values -s ',' column $columns +} + +_arguments \ + '(- *)'{-h,--help}'[display this help]' \ + '(- *)'{-V,--version}'[display version]' \ + '(-b --bytes)'{-b,--bytes}'[print SIZE in bytes rather]' \ + '(-J --json)'{-J,--json}'[use the JSON output format]' \ + '(-i --noinaccessible)'{-i,--noinaccessible}'[ignore locks without read permissions]' \ + '(-o --output)'{-o,--output=-}'[output columns]:columns:_lslocks_output_columns' \ + '(-o --output --output-all)--output-all[output all columns]' \ + '(-p --pid)'{-p,--pid}'[display only locks held by this process]:pid:_pids' \ + '(-r --raw)'{-r,--raw}'[use the raw output format]' \ + '(-u --notruncate)'{-u,--notruncate}'[do not truncate text in columns]' \ + '(- *)'{-H,--list-columns}'[list the available columns]' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From 667494f3346d91b187f286fc6e992e888913bd16 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 26 Oct 2025 16:26:30 +0900 Subject: [PATCH 3/4] add lsmem completion --- src/_lsmem | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/_lsmem diff --git a/src/_lsmem b/src/_lsmem new file mode 100644 index 0000000..d5bcf01 --- /dev/null +++ b/src/_lsmem @@ -0,0 +1,73 @@ +#compdef lsmem +# ------------------------------------------------------------------------------ +# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for lsmem v2.41 (https://github.com/util-linux/util-linux) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +(( $+functions[_lsmem_output_columns] )) || +_lsmem_output_columns() { + local -a columns=( + "RANGE[start and end address of the memory range]" + "SIZE[size of the memory range]" + "STATE[online status of the memory range]" + "REMOVABLE[memory is removable]" + "BLOCK[memory block number or blocks range]" + "NODE[numa node of memory]" + "ZONES[valid zones for the memory range]" + ) + + _values -s ',' column $columns +} + +_arguments \ + '(- *)'{-h,--help}'[display this help]' \ + '(- *)'{-V,--version}'[display version]' \ + '(-J --json)'{-J,--json}'[use the JSON output format]' \ + '(-P --pairs)'{-P,--pairs}'[use key=value output format]' \ + '(-a --all)'{-a,--all}'[list each individual memory block]' \ + '(-b --bytes)'{-b,--bytes}'[print SIZE in bytes rather]' \ + '(-n --noheadings)'{-n,--noheadings}'[do not print headings]' \ + '(-o --output)'{-o,--output=-}'[output columns]:columns:_lsmem_output_columns' \ + '(-o --output --output-all)--output-all[output all columns]' \ + '(-r --raw)'{-r,--raw}'[use the raw output format]' \ + '(-S --split)'{-S,--split}'[split ranges by specified columns]:columns:_lsmem_output_columns' \ + '(-s --sysroot)'{-s,--sysroot}'[use the specified directory as system root]:dir:_files -/' \ + '--summary=-[print summary information]:when:(never always only)' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From b66a1aba6333b2dfc7883b3ccf0a64f66ffc3816 Mon Sep 17 00:00:00 2001 From: Shohei YOSHIDA Date: Sun, 26 Oct 2025 16:43:26 +0900 Subject: [PATCH 4/4] add lslogins completion --- src/_lslogins | 107 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 src/_lslogins diff --git a/src/_lslogins b/src/_lslogins new file mode 100644 index 0000000..433db8d --- /dev/null +++ b/src/_lslogins @@ -0,0 +1,107 @@ +#compdef lslogins +# ------------------------------------------------------------------------------ +# Copyright (c) 2025 Github zsh-users - https://github.com/zsh-users +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for lslogins v2.41 (https://github.com/util-linux/util-linux) +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Shohei Yoshida (https://github.com/syohex) +# +# ------------------------------------------------------------------------------ + +(( $+functions[_lslogins_output_columns] )) || +_lslogins_output_columns() { + local -a columns=( + "USER[user name]" + "UID[user ID]" + "GECOS[full user name]" + "HOMEDIR[home directory]" + "SHELL[login shell]" + "NOLOGIN[log in disabled by nologin(8) or pam_nologin(8)]" + "PWD-LOCK[password defined, but locked]" + "PWD-EMPTY[password not defined]" + "PWD-DENY[login by password disabled]" + "PWD-METHOD[password encryption method]" + "GROUP[primary group name]" + "GID[primary group ID]" + "SUPP-GROUPS[supplementary group names]" + "SUPP-GIDS[supplementary group IDs]" + "LAST-LOGIN[date of last login]" + "LAST-TTY[last tty used]" + "LAST-HOSTNAME[hostname during the last session]" + "FAILED-LOGIN[date of last failed login]" + "FAILED-TTY[where did the login fail?]" + "HUSHED[user's hush settings]" + "PWD-WARN[days user is warned of password expiration]" + "PWD-CHANGE[date of last password change]" + "PWD-MIN[number of days required between changes]" + "PWD-MAX[max number of days a password may remain unchanged]" + "PWD-EXPIR[password expiration date]" + "CONTEXT[the user's security context]" + "PROC[number of processes run by the user]" + ) + + _values -s ',' column $columns +} + +_arguments \ + '(- *)'{-h,--help}'[display this help]' \ + '(- *)'{-V,--version}'[display version]' \ + '(-a --acc-expiration)'{-a,--acc-expiration}'[display info about passwords expiration]' \ + '(-c --colon-separate)'{-c,--colon-separate}'[display data in a format similar to /etc/passwd]' \ + '(-e --export)'{-e,--export}'[display in an export-able output format]' \ + '(-f --failed)'{-f,--failed}"[display data about the user's last failed logins]" \ + '(-G --supp-groups)'{-G,--supp-groups}'[display information about groups]' \ + '(-g --groups)'{-g,--groups=}'[display users belonging to the given group]:group:_groups' \ + '(-L --last)'{-L,--last}"[show info about the user's last login sessions]" \ + '(-l --logins)'{-l,--logins}'[display only users from the given logins]:logins' \ + '(-n --newline)'{-n,--newline}'[display each piece of information on a new line]'\ + '--noheadings[do not print headings]' \ + '--truncate[do not truncate output]' \ + '(-o --output)'{-o,--output=-}'[output columns]:columns:_lslogins_output_columns' \ + '(-o --output --output-all)--output-all[output all columns]' \ + '(-p --pwd)'{-p,--pwd}'[display information related to login by password]' \ + '(-r --raw)'{-r,--raw}'[display in raw mode]' \ + '(-s --system-accs)'{-s,--system-accs}'[display system accounts]' \ + '--time-format=[display dates format]:type:(short full iso)' \ + '(-u --user-accs)'{-u,--user-accs}'[display user accounts]' \ + '(-y --shell)'{-y,--shell}'[use column names to be usable as shell variable identifiers]' \ + '(-Z --context)'{-Z,--context}'[display SELinux contexts]' \ + '(-z --print0)'{-z,--print0}'[delimit user entries with a nul character]' \ + '--wtmp-file[set an alternate path for wtmp]:path:_files' \ + '--btmp-file[set an alternate path for btmp]:path:_files' \ + '--lastlog[set an alternate path for lastlog]:path:_files' \ + '--lastlog2[set an alternate path for lastlog2]:path:_files' + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et