lscss: Implement zsh and bash autocompletion

Add generation of shell autocompletion scripts.
Modify --devtype flag description to make it
compatible with zsh autocompletion.

Acked-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Szabina Korbai <szkorbai@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Szabina Korbai
2026-03-06 16:16:00 +01:00
committed by Jan Höppner
parent 35d5f41232
commit e9ee658492
5 changed files with 110 additions and 74 deletions
+1 -74
View File
@@ -21,18 +21,9 @@
#include "lib/util_rec.h"
#include "lib/util_scandir.h"
#include "lscss_cli.h"
#include "misc.h"
/*
* Numbers for lscss command options that do not have a short form
*/
#define OPT_AVAIL 256 /* --avail */
#define OPT_VPM 257 /* --vpm */
#define OPT_IO 258 /* --io */
#define OPT_CHSC 259 /* --chsc */
#define OPT_EADM 260 /* --eadm */
#define OPT_VFIO 261 /* --vfio */
/* Bus_id format for subchannel or device id */
#define ID_FORMAT "^[[:xdigit:]]{1,2}[.][[:xdigit:]][.][[:xdigit:]]{4}$"
/* UUID format */
@@ -109,70 +100,6 @@ static const struct util_prg prg = {
}
};
/*
* Command line options
*/
static struct util_opt opt_vec[] = {
UTIL_OPT_SECTION("OPTIONS"),
{
.option = { "short", no_argument, NULL, 's'},
.desc = "Shorten IDs by removing leading \"0.0.\" "
"Note: only IDs beginning with \"0.0.\" "
"will be displayed in this case.",
},
{
.option = { "devtype", required_argument, NULL, 't'},
.argument = "TYPE,..",
.desc = "For IO subchannels, limit output to devices of "
"the given TYPE (DEVTYPE[/MODEL])",
},
{
.option = { "devrange", no_argument, NULL, 'd'},
.desc = "Indicate that RANGE refers to device identifiers",
},
{
.option = { "avail", no_argument, NULL, OPT_AVAIL},
.desc = "Show availability attribute of IO devices",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "vpm", no_argument, NULL, OPT_VPM},
.desc = "Show verified path mask",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "uppercase", no_argument, NULL, 'u'},
.desc = "Print values using uppercase",
},
{
.option = { "io", no_argument, NULL, OPT_IO},
.desc = "Show IO subchannels (default)",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "chsc", no_argument, NULL, OPT_CHSC},
.desc = "Show CHSC subchannels",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "eadm", no_argument, NULL, OPT_EADM},
.desc = "Show EADM subchannels",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "vfio", no_argument, NULL, OPT_VFIO},
.desc = "Show VFIO subchannel information",
.flags = UTIL_OPT_FLAG_NOSHORT,
},
{
.option = { "all", no_argument, NULL, 'a'},
.desc = "Show subchannels of all types",
},
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
/*
* Add new subchannel or device range to the ranges list for further output
* limitation