lsqeth: Implement zsh and bash autocompletion

Add generation of shell autocompletion scripts.

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:23:39 +01:00
committed by Jan Höppner
parent e9ee658492
commit f70991ab1e
5 changed files with 50 additions and 14 deletions

2
.gitignore vendored
View File

@@ -131,6 +131,8 @@ zconf/css/lscss
zconf/css/_lscss
zconf/css/lscss.bash
zconf/qeth/lsqeth
zconf/qeth/_lsqeth
zconf/qeth/lsqeth.bash
zconf/scm/lsscm
zconf/zcrypt/chzcrypt
zconf/zcrypt/lszcrypt

View File

@@ -1,5 +1,10 @@
include ../../common.mak
zsh-completions = _lsqeth
bash-completions = lsqeth.bash
include ../../common_autocomp.mak
all: lsqeth
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a

View File

@@ -0,0 +1,16 @@
/*
* SPDX-License-Identifier: MIT
*
* Copyright IBM Corp.
*/
#include "lib/util_autocomp.h"
#include "lsqeth_cli.h"
int main(void)
{
generate_autocomp(opt_vec, "lsqeth");
return 0;
}

View File

@@ -39,6 +39,7 @@
#include "lib/zt_common.h"
#include "lib/vmcp.h"
#include "lsqeth_cli.h"
#include "misc.h"
#define ID_FORMAT "^[[:xdigit:]]{1,2}[.][[:xdigit:]][.][[:xdigit:]]{4}$"
@@ -70,20 +71,6 @@ const struct util_prg prg = {
}
};
/*
* Command line options
*/
static struct util_opt opt_vec[] = {
UTIL_OPT_SECTION("OPTIONS"),
{
.option = { "proc", no_argument, NULL, 'p'},
.desc = "List all devices in the former /proc/qeth format"
},
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
/*
* Exchange content of field value via simple translation map
*

26
zconf/qeth/lsqeth_cli.h Normal file
View File

@@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: MIT
*
* Copyright IBM Corp.
*/
#ifndef LSQETH_CLI_H
#define LSQETH_CLI_H
#include "lib/util_opt.h"
/*
* Command line options
*/
static struct util_opt opt_vec[] = {
UTIL_OPT_SECTION("OPTIONS"),
{
.option = { "proc", no_argument, NULL, 'p'},
.desc = "List all devices in the former /proc/qeth format"
},
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
#endif