aboutsummaryrefslogtreecommitdiffstats
path: root/src/_lsipc
blob: a7da0d4003c20a8642fd2ca8fb284a3b324bc644 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
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) <syohex@gmail.com>
#
# ------------------------------------------------------------------------------

(( $+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