fix: relayd: unaligned access in trace_chunk_registry_ht_key_hash
[lttng-tools.git] / extras / zsh-completion / _lttng-crash
1 #compdef lttng-crash
2 #
3 # Copyright (c) 2015-2023 Philippe Proulx <eeppeliteloop@gmail.com>
4 #
5 # Permission is hereby granted, free of charge, to any person obtaining a copy
6 # of this software and associated documentation files (the "Software"), to deal
7 # in the Software without restriction, including without limitation the rights
8 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 # copies of the Software, and to permit persons to whom the Software is
10 # furnished to do so, subject to the following conditions:
11 #
12 # The above copyright notice and this permission notice shall be included in
13 # all copies or substantial portions of the Software.
14 #
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 # THE SOFTWARE.
22 #
23 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
24 #
25 # This is a Zsh completion function for the lttng-crash(1) command (see
26 # <https://lttng.org/>), for versions 2.7 to 2.14.
27 #
28 # If you want, at your own risk, the function to work with versions
29 # above 2.14, set `LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT=1`.
30
31 # Sets the `minor_version` variable to the minor version of LTTng-tools,
32 # or to `0` if not found.
33 __lttng_set_minor_version() {
34 minor_version=0
35
36 local -a match
37
38 if [[ $($words[1] --version) =~ '[[:blank:]]+2\.([[:digit:]]+)' ]]; then
39 minor_version=$match[1]
40 fi
41 }
42
43 # Adds completions for the arguments of the `lttng-crash` command.
44 __lttng_complete_lttng_crash() {
45 local curcontext=$curcontext state state_descr line
46 local -A opt_args
47 local specs=(
48 '*'{-v,--verbose}'[increase verbosity]'
49 '(- : *)'{-V,--version}'[show version and quit]'
50 '(- : *)'{-h,--help}'[show help]'
51 '(-x --extract)'{-x+,--extract=}'[set the path of the directory where to extract the trace]:trace extraction directory path:_directories'
52 '(-e --viewer)'{-e+,--viewer=}'[set the trace reader command]:trace reader command:_files'
53 '1:shared memory directory:_directories'
54 )
55
56 _arguments -C -s -w : $specs
57 }
58
59 # First, set the `minor_version` variable to the minor version of
60 # LTTng-tools. Some features depend on a specific version and this
61 # completion function supports many versions from LTTng-tools 2.7.
62 local -i minor_version
63
64 __lttng_set_minor_version
65
66 # Exit now with LTTng-tools < 2.7 or LTTng-tools > 2.14
67 local -r ignore_version_limit=${LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT:-0}
68
69 if ((minor_version < 7 || (minor_version > 14 && !ignore_version_limit))); then
70 _message "completion not available for LTTng-tools 2.$minor_version; please update the completion files or set \`LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT=1\`"
71 return 1
72 fi
73
74 # Add completions for lttng-crash(1)
75 __lttng_complete_lttng_crash "$@"
This page took 0.030058 seconds and 4 git commands to generate.