mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
dasdview: 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
364cb9d869
commit
e7e9f137c1
2
.gitignore
vendored
2
.gitignore
vendored
@@ -53,6 +53,8 @@ dasdinfo/dasdinfo
|
|||||||
dasdinfo/_dasdinfo
|
dasdinfo/_dasdinfo
|
||||||
dasdinfo/dasdinfo.bash
|
dasdinfo/dasdinfo.bash
|
||||||
dasdview/dasdview
|
dasdview/dasdview
|
||||||
|
dasdview/_dasdview
|
||||||
|
dasdview/dasdview.bash
|
||||||
dump2tar/src/dump2tar
|
dump2tar/src/dump2tar
|
||||||
fdasd/fdasd
|
fdasd/fdasd
|
||||||
hmcdrvfs/hmcdrvfs
|
hmcdrvfs/hmcdrvfs
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
include ../common.mak
|
include ../common.mak
|
||||||
|
|
||||||
|
zsh-completions = _dasdview
|
||||||
|
bash-completions = dasdview.bash
|
||||||
|
|
||||||
|
include ../common_autocomp.mak
|
||||||
|
|
||||||
libs = $(rootdir)/libdasd/libdasd.a \
|
libs = $(rootdir)/libdasd/libdasd.a \
|
||||||
$(rootdir)/libzds/libzds.a \
|
$(rootdir)/libzds/libzds.a \
|
||||||
$(rootdir)/libvtoc/libvtoc.a \
|
$(rootdir)/libvtoc/libvtoc.a \
|
||||||
|
|||||||
16
dasdview/autocompletion_generator_host.c
Normal file
16
dasdview/autocompletion_generator_host.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/util_autocomp.h"
|
||||||
|
|
||||||
|
#include "dasdview_cli.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
generate_autocomp(opt_vec, "dasdview");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "lib/zt_common.h"
|
#include "lib/zt_common.h"
|
||||||
|
|
||||||
#include "dasdview.h"
|
#include "dasdview.h"
|
||||||
|
#include "dasdview_cli.h"
|
||||||
|
|
||||||
/* Characters per line */
|
/* Characters per line */
|
||||||
#define DASDVIEW_CPL 16
|
#define DASDVIEW_CPL 16
|
||||||
@@ -56,61 +57,6 @@ static const struct util_prg prg = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct util_opt opt_vec[] = {
|
|
||||||
UTIL_OPT_SECTION("DUMP OPTIONS"),
|
|
||||||
{
|
|
||||||
.option = { NULL, no_argument, NULL, '1' },
|
|
||||||
.desc = "Show DASD content in short Hex/EBCDIC/ASCII format",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOLONG,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { NULL, no_argument, NULL, '2' },
|
|
||||||
.desc = "Show DASD content in detailed Hex/EBCDIC/ASCII format",
|
|
||||||
.flags = UTIL_OPT_FLAG_NOLONG,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "begin", required_argument, NULL, 'b' },
|
|
||||||
.argument = "BEGIN",
|
|
||||||
.desc = "Specify start of dump in kilobytes (suffix k), "
|
|
||||||
"megabytes (m), blocks (b), tracks (t), or cylinders (c)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "size", required_argument, NULL, 's' },
|
|
||||||
.argument = "SIZE",
|
|
||||||
.desc = "Specify size of dump in kilobytes (suffix k), "
|
|
||||||
"megabytes (m), blocks (b), tracks (t), or cylinders (c)",
|
|
||||||
},
|
|
||||||
UTIL_OPT_SECTION("MISC"),
|
|
||||||
{
|
|
||||||
.option = { "characteristic", no_argument, NULL, 'c' },
|
|
||||||
.desc = "Print the characteristics of a device",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "info", no_argument, NULL, 'i' },
|
|
||||||
.desc = "Print general DASD information and geometry",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "volser", no_argument, NULL, 'j' },
|
|
||||||
.desc = "Print the volume serial number",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "label", no_argument, NULL, 'l' },
|
|
||||||
.desc = "Print information about the volume label",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "vtoc", required_argument, NULL, 't' },
|
|
||||||
.argument = "SPEC",
|
|
||||||
.desc = "Print the table of content (VTOC)",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "extended", no_argument, NULL, 'x' },
|
|
||||||
.desc = "Print extended DASD information",
|
|
||||||
},
|
|
||||||
UTIL_OPT_HELP,
|
|
||||||
UTIL_OPT_VERSION,
|
|
||||||
UTIL_OPT_END
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Generate and print an error message based on the formatted
|
* Generate and print an error message based on the formatted
|
||||||
* text string FMT and a variable amount of extra arguments.
|
* text string FMT and a variable amount of extra arguments.
|
||||||
|
|||||||
67
dasdview/dasdview_cli.h
Normal file
67
dasdview/dasdview_cli.h
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef DASDVIEW_CLI_H
|
||||||
|
#define DASDVIEW_CLI_H
|
||||||
|
|
||||||
|
#include "lib/util_opt.h"
|
||||||
|
|
||||||
|
static struct util_opt opt_vec[] = {
|
||||||
|
UTIL_OPT_SECTION("DUMP OPTIONS"),
|
||||||
|
{
|
||||||
|
.option = { NULL, no_argument, NULL, '1' },
|
||||||
|
.desc = "Show DASD content in short Hex/EBCDIC/ASCII format",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOLONG,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { NULL, no_argument, NULL, '2' },
|
||||||
|
.desc = "Show DASD content in detailed Hex/EBCDIC/ASCII format",
|
||||||
|
.flags = UTIL_OPT_FLAG_NOLONG,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "begin", required_argument, NULL, 'b' },
|
||||||
|
.argument = "BEGIN",
|
||||||
|
.desc = "Specify start of dump in kilobytes (suffix k), "
|
||||||
|
"megabytes (m), blocks (b), tracks (t), or cylinders (c)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "size", required_argument, NULL, 's' },
|
||||||
|
.argument = "SIZE",
|
||||||
|
.desc = "Specify size of dump in kilobytes (suffix k), "
|
||||||
|
"megabytes (m), blocks (b), tracks (t), or cylinders (c)",
|
||||||
|
},
|
||||||
|
UTIL_OPT_SECTION("MISC"),
|
||||||
|
{
|
||||||
|
.option = { "characteristic", no_argument, NULL, 'c' },
|
||||||
|
.desc = "Print the characteristics of a device",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "info", no_argument, NULL, 'i' },
|
||||||
|
.desc = "Print general DASD information and geometry",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "volser", no_argument, NULL, 'j' },
|
||||||
|
.desc = "Print the volume serial number",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "label", no_argument, NULL, 'l' },
|
||||||
|
.desc = "Print information about the volume label",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "vtoc", required_argument, NULL, 't' },
|
||||||
|
.argument = "SPEC",
|
||||||
|
.desc = "Print the table of content (VTOC)",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "extended", no_argument, NULL, 'x' },
|
||||||
|
.desc = "Print extended DASD information",
|
||||||
|
},
|
||||||
|
UTIL_OPT_HELP,
|
||||||
|
UTIL_OPT_VERSION,
|
||||||
|
UTIL_OPT_END
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user