Add Zsh completion files for public LTTng CLI commands
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 30 Aug 2023 16:33:13 +0000 (12:33 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 29 Feb 2024 22:22:53 +0000 (17:22 -0500)
commit76bcac588cf4812f6a429ff81734910a0fcb4f64
tree0237cf1369ad7a67d8d2056b3082c001e77650fb
parent885078d1004705e79400e109dc7cf9620cafcc4e
Add Zsh completion files for public LTTng CLI commands

Zsh is an extended Bourne shell with many improvements, including some
features of Bash, ksh, and tcsh. Zsh features a powerful completion
system which makes it possible to improve the interactive user
experience greatly when using an LTTng command.

Those four new files are Very Sophisticated Zsh completion files,
especially `extras/zsh-completion/_lttng`.

Notable features for all commands:

* Support of LTTng 2.5 through LTTng 2.14, with version-specific
  completion.

  Set `LTTNG_ZSH_COMP_IGNORE_VERSION_LIMIT=1` to disable the upper limit
  of the version check. This should be safe most of the time, but if
  there's a breaking change in option/argument interaction, the
  completions might be wrong.

* Exclusion of options and arguments depending on the current options
  and arguments, according to the manual pages.

  For example, for `lttng enable-channel`, you cannot specify
  `--buffers-uid` if you already specified `--kernel` (and vice versa).

Notable features for the `lttng` command:

* Full support, except for the condition and action specifiers of the
  `add-trigger` subcommand: although I may now add "skillful in Zsh
  completion" to my resume, the positional design of `--condition` and
  `--action` needs event more spicy Zsh wizardry which I didn't explore
  yet.

* Custom tags and support for the `verbose` style to customize the
  completion behaviour and look with `zstyle`.

* For any dynamic completion (relying on some output of the `lttng`
  command), connect to the right session daemon depending on the
  selected tracing group (`g`/`--group`).

* User/group ID completion with displayed corresponding Unix user/group
  names.

* Dynamic recording session name completion with a summary of properties
  (activity and mode).

  Only the relevant ones are added to the completion set. For example,
  names of active sessions are not part of the completion set for
  `lttng start`.

* Current recording session taken into account for subcommands needing
  one when you don't specify the dedicated recording session
  option/argument.

* Dynamic channel name completion depending on the selected recording
  session and tracing domain, with a summary of properties (status,
  tracing domain, event record loss mode).

  Only the relevant ones are added to the completion set. For example,
  names of enabled channels are not part of the completion set for
  `lttng enable-channel`.

* Dynamic recording event rule name condition completion for
  `lttng disable-event`.

* Dynamic instrumentation point name completion depending on the
  selected tracing domain

* Dynamic context field type completion depending on the selected
  tracing domain.

* Log level name completion depending on the selected tracing domain.

* Dynamic trigger name completion depending on the selected owner
  user ID.

Notable features for the `lttng-sessiond` command:

* LTTng kernel probe module name completion (checks within the
  `/usr/lib/modules` directory).

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: If8c2c58a50664f41ecc41ab1df72879127d1cd02
Makefile.am
extras/zsh-completion/_lttng [new file with mode: 0644]
extras/zsh-completion/_lttng-crash [new file with mode: 0644]
extras/zsh-completion/_lttng-relayd [new file with mode: 0644]
extras/zsh-completion/_lttng-sessiond [new file with mode: 0644]
This page took 0.025723 seconds and 4 git commands to generate.