mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
zpcictl: 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
755ea88d5d
commit
68309ccb7f
@@ -168,4 +168,6 @@ zkey/zkey
|
|||||||
zkey/zkey-cryptsetup
|
zkey/zkey-cryptsetup
|
||||||
zmemtopo/zmemtopo
|
zmemtopo/zmemtopo
|
||||||
zpcictl/zpcictl
|
zpcictl/zpcictl
|
||||||
|
zpcictl/_zpcictl
|
||||||
|
zpcictl/zpcictl.bash
|
||||||
zpwr/zpwr
|
zpwr/zpwr
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
include ../common.mak
|
include ../common.mak
|
||||||
|
|
||||||
|
zsh-completions = _zpcictl
|
||||||
|
bash-completions = zpcictl.bash
|
||||||
|
|
||||||
|
include ../common_autocomp.mak
|
||||||
|
|
||||||
all: zpcictl
|
all: zpcictl
|
||||||
|
|
||||||
libs = $(rootdir)/libzpci/libzpci.a $(rootdir)/libutil/libutil.a
|
libs = $(rootdir)/libzpci/libzpci.a $(rootdir)/libutil/libutil.a
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/util_autocomp.h"
|
||||||
|
|
||||||
|
#include "zpcictl_cli.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
generate_autocomp(opt_vec, "zpcictl");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+1
-43
@@ -23,6 +23,7 @@
|
|||||||
#include "lib/pci_sclp.h"
|
#include "lib/pci_sclp.h"
|
||||||
|
|
||||||
#include "zpcictl.h"
|
#include "zpcictl.h"
|
||||||
|
#include "zpcictl_cli.h"
|
||||||
|
|
||||||
#define SMARTCTL_CMDLINE "smartctl -x %s 2>/dev/null"
|
#define SMARTCTL_CMDLINE "smartctl -x %s 2>/dev/null"
|
||||||
|
|
||||||
@@ -41,49 +42,6 @@ static const struct util_prg prg = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Defines for options with no short command */
|
|
||||||
#define OPT_RESET 128
|
|
||||||
#define OPT_DECONF 129
|
|
||||||
#define OPT_REPORT_ERR 130
|
|
||||||
#define OPT_RESET_FW 131
|
|
||||||
|
|
||||||
static struct util_opt opt_vec[] = {
|
|
||||||
UTIL_OPT_SECTION("ERROR HANDLING OPTIONS"),
|
|
||||||
{
|
|
||||||
.option = { "reset", no_argument, NULL, OPT_RESET },
|
|
||||||
.desc = "Reset the device and report an error to the Support Element (SE). "
|
|
||||||
"The reset consists of a controlled shutdown and a subsequent "
|
|
||||||
"re-enabling of the device. As a result, higher level interfaces such "
|
|
||||||
"as network interfaces and block devices are destroyed and re-created.\n"
|
|
||||||
"Manual configuration steps might be required to re-integrate the device, "
|
|
||||||
"for example, in bonded interfaces or software RAIDs.\n"
|
|
||||||
"Use this option only if the automatic recovery failed, or if it did "
|
|
||||||
"not succeed to restore regular operations of the device and manual "
|
|
||||||
"intervention is required.\n",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "reset-fw", no_argument, NULL, OPT_RESET_FW },
|
|
||||||
.desc = "Reset the device through a firmware driven reset that triggers "
|
|
||||||
"automatic recovery and reports an error to the Support Element (SE).\n",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "deconfigure", no_argument, NULL, OPT_DECONF },
|
|
||||||
.desc = "Deconfigure the device to prepare for any repair action",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "report-error", no_argument, NULL, OPT_REPORT_ERR },
|
|
||||||
.desc = "Report a device error to the Support Element (SE)",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOSHORT,
|
|
||||||
},
|
|
||||||
UTIL_OPT_SECTION("GENERAL OPTIONS"),
|
|
||||||
UTIL_OPT_HELP,
|
|
||||||
UTIL_OPT_VERSION,
|
|
||||||
UTIL_OPT_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static int is_char_dev(const char *dev)
|
static int is_char_dev(const char *dev)
|
||||||
{
|
{
|
||||||
struct stat s;
|
struct stat s;
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZPCICTL_CLI_H
|
||||||
|
#define ZPCICTL_CLI_H
|
||||||
|
|
||||||
|
#include "lib/util_opt.h"
|
||||||
|
|
||||||
|
/* Defines for options with no short command */
|
||||||
|
#define OPT_RESET 128
|
||||||
|
#define OPT_DECONF 129
|
||||||
|
#define OPT_REPORT_ERR 130
|
||||||
|
#define OPT_RESET_FW 131
|
||||||
|
|
||||||
|
static struct util_opt opt_vec[] = {
|
||||||
|
UTIL_OPT_SECTION("ERROR HANDLING OPTIONS"),
|
||||||
|
{
|
||||||
|
.option = { "reset", no_argument, NULL, OPT_RESET },
|
||||||
|
.desc = "Reset the device and report an error to the Support Element (SE). "
|
||||||
|
"The reset consists of a controlled shutdown and a subsequent "
|
||||||
|
"re-enabling of the device. As a result, higher level interfaces such "
|
||||||
|
"as network interfaces and block devices are destroyed and re-created.\n"
|
||||||
|
"Manual configuration steps might be required to re-integrate the device, "
|
||||||
|
"for example, in bonded interfaces or software RAIDs.\n"
|
||||||
|
"Use this option only if the automatic recovery failed, or if it did "
|
||||||
|
"not succeed to restore regular operations of the device and manual "
|
||||||
|
"intervention is required.\n",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "reset-fw", no_argument, NULL, OPT_RESET_FW },
|
||||||
|
.desc = "Reset the device through a firmware driven reset that triggers "
|
||||||
|
"automatic recovery and reports an error to the Support Element (SE).\n",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "deconfigure", no_argument, NULL, OPT_DECONF },
|
||||||
|
.desc = "Deconfigure the device to prepare for any repair action",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "report-error", no_argument, NULL, OPT_REPORT_ERR },
|
||||||
|
.desc = "Report a device error to the Support Element (SE)",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOSHORT,
|
||||||
|
},
|
||||||
|
UTIL_OPT_SECTION("GENERAL OPTIONS"),
|
||||||
|
UTIL_OPT_HELP,
|
||||||
|
UTIL_OPT_VERSION,
|
||||||
|
UTIL_OPT_END
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user