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