diff --git a/.gitignore b/.gitignore index c3d9e655..28d8ca33 100644 --- a/.gitignore +++ b/.gitignore @@ -98,6 +98,8 @@ libutil/*_example libvmcp/vmcp_example libzds/libzds.a lsstp/lsstp +lsstp/_lsstp +lsstp/lsstp.bash mon_tools/mon_fsstatd mon_tools/mon_procd opticsmon/opticsmon diff --git a/lsstp/Makefile b/lsstp/Makefile index c8fb605c..bc36333a 100644 --- a/lsstp/Makefile +++ b/lsstp/Makefile @@ -1,5 +1,10 @@ include ../common.mak +zsh-completions = _lsstp +bash-completions = lsstp.bash + +include ../common_autocomp.mak + libs = $(rootdir)/libutil/libutil.a all: lsstp diff --git a/lsstp/autocompletion_generator_host.c b/lsstp/autocompletion_generator_host.c new file mode 100644 index 00000000..3d7f9738 --- /dev/null +++ b/lsstp/autocompletion_generator_host.c @@ -0,0 +1,16 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright IBM Corp. + */ + +#include "lib/util_autocomp.h" + +#include "lsstp_cli.h" + +int main(void) +{ + generate_autocomp(opt_vec, "lsstp"); + + return 0; +} diff --git a/lsstp/lsstp.c b/lsstp/lsstp.c index 8b29f47f..40760d96 100644 --- a/lsstp/lsstp.c +++ b/lsstp/lsstp.c @@ -22,6 +22,8 @@ #include "lib/util_prg.h" #include "lib/util_path.h" +#include "lsstp_cli.h" + static const struct util_prg prg = { .desc = "Display STP system information", .args = "", @@ -34,12 +36,6 @@ static const struct util_prg prg = { } }; -static struct util_opt opt_vec[] = { - UTIL_OPT_HELP, - UTIL_OPT_VERSION, - UTIL_OPT_END -}; - struct stp_parms { uint64_t ctn_id; unsigned int online; diff --git a/lsstp/lsstp_cli.h b/lsstp/lsstp_cli.h new file mode 100644 index 00000000..7b26e88a --- /dev/null +++ b/lsstp/lsstp_cli.h @@ -0,0 +1,18 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright IBM Corp. + */ + +#ifndef LSSTP_CLI_H +#define LSSTP_CLI_H + +#include "lib/util_opt.h" + +static struct util_opt opt_vec[] = { + UTIL_OPT_HELP, + UTIL_OPT_VERSION, + UTIL_OPT_END +}; + +#endif