lsscm: 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:32:06 +01:00
committed by Jan Höppner
parent f70991ab1e
commit 6dbc5646f9
5 changed files with 46 additions and 9 deletions

2
.gitignore vendored
View File

@@ -134,6 +134,8 @@ zconf/qeth/lsqeth
zconf/qeth/_lsqeth
zconf/qeth/lsqeth.bash
zconf/scm/lsscm
zconf/scm/_lsscm
zconf/scm/lsscm.bash
zconf/zcrypt/chzcrypt
zconf/zcrypt/lszcrypt
zconf/zcrypt/zcryptctl

View File

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

View File

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

View File

@@ -19,6 +19,8 @@
#include "lib/util_scandir.h"
#include "lib/zt_common.h"
#include "lsscm_cli.h"
/*
* Program configuration
*/
@@ -34,15 +36,6 @@ const struct util_prg prg = {
}
};
/*
* Configuration of command line options
*/
static struct util_opt opt_vec[] = {
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
/**
* Print all attributes of one device
*

21
zconf/scm/lsscm_cli.h Normal file
View File

@@ -0,0 +1,21 @@
/*
* SPDX-License-Identifier: MIT
*
* Copyright IBM Corp.
*/
#ifndef LSSCM_CLI_H
#define LSSCM_CLI_H
#include "lib/util_opt.h"
/*
* Configuration of command line options
*/
static struct util_opt opt_vec[] = {
UTIL_OPT_HELP,
UTIL_OPT_VERSION,
UTIL_OPT_END
};
#endif