mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zipl-editenv: 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:
committed by
Jan Höppner
parent
6dbc5646f9
commit
7730f2489f
2
.gitignore
vendored
2
.gitignore
vendored
@@ -167,6 +167,8 @@ zipl/src/chreipl_helper.device-mapper
|
||||
zipl/src/chreipl_helper.md
|
||||
zipl/src/zipl
|
||||
zipl/src/zipl-editenv
|
||||
zipl/src/_zipl-editenv
|
||||
zipl/src/zipl-editenv.bash
|
||||
zipl/src/zipl_helper.device-mapper
|
||||
zipl/src/zipl_helper.md
|
||||
zkey/check-dep-zkey
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
# Common definitions
|
||||
include ../../common.mak
|
||||
|
||||
zsh-completions = _zipl-editenv
|
||||
bash-completions = zipl-editenv.bash
|
||||
|
||||
include ../../common_autocomp.mak
|
||||
|
||||
ALL_CPPFLAGS += -I../include -I../boot \
|
||||
-DZFCPDUMP_IMAGE="STRINGIFY($(ZFCPDUMP_DIR)/$(ZFCPDUMP_IMAGE))" \
|
||||
-DZFCPDUMP_INITRD="STRINGIFY($(ZFCPDUMP_DIR)/$(ZFCPDUMP_INITRD))" \
|
||||
|
||||
16
zipl/src/autocompletion_generator_host.c
Normal file
16
zipl/src/autocompletion_generator_host.c
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright IBM Corp.
|
||||
*/
|
||||
|
||||
#include "lib/util_autocomp.h"
|
||||
|
||||
#include "zipl_editenv_cli.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
generate_autocomp(opt_vec, "zipl-editenv");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -18,17 +18,20 @@
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <assert.h>
|
||||
#include "disk.h"
|
||||
#include "error.h"
|
||||
#include "misc.h"
|
||||
#include "bootmap.h"
|
||||
#include "envblk.h"
|
||||
|
||||
#include "lib/util_prg.h"
|
||||
#include "lib/util_opt.h"
|
||||
#include "lib/util_part.h"
|
||||
#include "lib/util_path.h"
|
||||
#include "lib/util_proc.h"
|
||||
|
||||
#include "bootmap.h"
|
||||
#include "disk.h"
|
||||
#include "envblk.h"
|
||||
#include "error.h"
|
||||
#include "misc.h"
|
||||
#include "zipl_editenv_cli.h"
|
||||
|
||||
/* from linux/fs.h */
|
||||
#define FIBMAP _IO(0x00, 1)
|
||||
|
||||
@@ -426,52 +429,6 @@ static int set_effective_site_id(char *arg)
|
||||
return set_site_id_common(arg, &eff_site_id);
|
||||
}
|
||||
|
||||
static struct util_opt opt_vec[] = {
|
||||
UTIL_OPT_SECTION("OPTIONS WITHOUT ARGUMENTS"),
|
||||
{
|
||||
.option = { "list", no_argument, NULL, 'l'},
|
||||
.desc = "print list of zIPL environment variables with their values",
|
||||
},
|
||||
{
|
||||
.option = { "reset", no_argument, NULL, 'r'},
|
||||
.desc = "remove all variables from zIPL environment",
|
||||
},
|
||||
{
|
||||
.option = { "verbose", no_argument, NULL, 'V'},
|
||||
.desc = "provide more information",
|
||||
},
|
||||
UTIL_OPT_SECTION("OPTIONS WITH ARGUMENTS"),
|
||||
{
|
||||
.option = { "target", required_argument, NULL, 't'},
|
||||
.argument = "DIR",
|
||||
.desc = "specify directory, where bootmap file is located",
|
||||
},
|
||||
{
|
||||
.option = { "site", required_argument, NULL, 'S'},
|
||||
.argument = "SITE",
|
||||
.desc = "specify site ID",
|
||||
},
|
||||
{
|
||||
.option = { "effective-site", required_argument, NULL, 'E'},
|
||||
.argument = "SITE",
|
||||
.desc = "specify effective site ID",
|
||||
},
|
||||
{
|
||||
.option = { "set", required_argument, NULL, 's'},
|
||||
.argument = "NAME=VALUE",
|
||||
.desc = "assign value VALUE to variable NAME",
|
||||
},
|
||||
{
|
||||
.option = { "unset", required_argument, NULL, 'u'},
|
||||
.argument = "NAME",
|
||||
.desc = "remove variable NAME from zIPL environment",
|
||||
},
|
||||
UTIL_OPT_SECTION("STANDARD OPTIONS"),
|
||||
UTIL_OPT_HELP,
|
||||
UTIL_OPT_VERSION,
|
||||
UTIL_OPT_END,
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
enum op_id opcode = INVALID_OP_ID;
|
||||
|
||||
58
zipl/src/zipl_editenv_cli.h
Normal file
58
zipl/src/zipl_editenv_cli.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright IBM Corp.
|
||||
*/
|
||||
|
||||
#ifndef ZIPL_EDITENV_CLI_H
|
||||
#define ZIPL_EDITENV_CLI_H
|
||||
|
||||
#include "lib/util_opt.h"
|
||||
|
||||
static struct util_opt opt_vec[] = {
|
||||
UTIL_OPT_SECTION("OPTIONS WITHOUT ARGUMENTS"),
|
||||
{
|
||||
.option = { "list", no_argument, NULL, 'l'},
|
||||
.desc = "print list of zIPL environment variables with their values",
|
||||
},
|
||||
{
|
||||
.option = { "reset", no_argument, NULL, 'r'},
|
||||
.desc = "remove all variables from zIPL environment",
|
||||
},
|
||||
{
|
||||
.option = { "verbose", no_argument, NULL, 'V'},
|
||||
.desc = "provide more information",
|
||||
},
|
||||
UTIL_OPT_SECTION("OPTIONS WITH ARGUMENTS"),
|
||||
{
|
||||
.option = { "target", required_argument, NULL, 't'},
|
||||
.argument = "DIR",
|
||||
.desc = "specify directory, where bootmap file is located",
|
||||
},
|
||||
{
|
||||
.option = { "site", required_argument, NULL, 'S'},
|
||||
.argument = "SITE",
|
||||
.desc = "specify site ID",
|
||||
},
|
||||
{
|
||||
.option = { "effective-site", required_argument, NULL, 'E'},
|
||||
.argument = "SITE",
|
||||
.desc = "specify effective site ID",
|
||||
},
|
||||
{
|
||||
.option = { "set", required_argument, NULL, 's'},
|
||||
.argument = "NAME=VALUE",
|
||||
.desc = "assign value VALUE to variable NAME",
|
||||
},
|
||||
{
|
||||
.option = { "unset", required_argument, NULL, 'u'},
|
||||
.argument = "NAME",
|
||||
.desc = "remove variable NAME from zIPL environment",
|
||||
},
|
||||
UTIL_OPT_SECTION("STANDARD OPTIONS"),
|
||||
UTIL_OPT_HELP,
|
||||
UTIL_OPT_VERSION,
|
||||
UTIL_OPT_END,
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user