mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
vmcp: 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
af99efaab2
commit
755ea88d5d
2
.gitignore
vendored
2
.gitignore
vendored
@@ -115,6 +115,8 @@ tunedasd/src/tunedasd
|
|||||||
tunedasd/src/_tunedasd
|
tunedasd/src/_tunedasd
|
||||||
tunedasd/src/tunedasd.bash
|
tunedasd/src/tunedasd.bash
|
||||||
vmcp/vmcp
|
vmcp/vmcp
|
||||||
|
vmcp/_vmcp
|
||||||
|
vmcp/vmcp.bash
|
||||||
vmur/vmur
|
vmur/vmur
|
||||||
zconf/chp/chchp
|
zconf/chp/chchp
|
||||||
zconf/chp/lschp
|
zconf/chp/lschp
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
include ../common.mak
|
include ../common.mak
|
||||||
|
|
||||||
|
zsh-completions = _vmcp
|
||||||
|
bash-completions = vmcp.bash
|
||||||
|
|
||||||
|
include ../common_autocomp.mak
|
||||||
|
|
||||||
all: vmcp
|
all: vmcp
|
||||||
|
|
||||||
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a
|
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a
|
||||||
|
|||||||
16
vmcp/autocompletion_generator_host.c
Normal file
16
vmcp/autocompletion_generator_host.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "lib/util_autocomp.h"
|
||||||
|
|
||||||
|
#include "vmcp_cli.h"
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
generate_autocomp(opt_vec, "vmcp");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
vmcp/vmcp.c
20
vmcp/vmcp.c
@@ -36,6 +36,8 @@
|
|||||||
#include "lib/util_opt.h"
|
#include "lib/util_opt.h"
|
||||||
#include "lib/util_prg.h"
|
#include "lib/util_prg.h"
|
||||||
|
|
||||||
|
#include "vmcp_cli.h"
|
||||||
|
|
||||||
#define MAXBUFFER 1048576
|
#define MAXBUFFER 1048576
|
||||||
#define MINBUFFER 4096
|
#define MINBUFFER 4096
|
||||||
#define MAXCMDLEN 240
|
#define MAXCMDLEN 240
|
||||||
@@ -50,24 +52,6 @@ static int keep_case = 0;
|
|||||||
static int buffersize = VMCP_DEFAULT_BUFSZ;
|
static int buffersize = VMCP_DEFAULT_BUFSZ;
|
||||||
static char command[MAXCMDLEN + 1];
|
static char command[MAXCMDLEN + 1];
|
||||||
|
|
||||||
static struct util_opt opt_vec[] = {
|
|
||||||
UTIL_OPT_SECTION("OPTIONS"),
|
|
||||||
{
|
|
||||||
.option = { "keepcase", no_argument, NULL, 'k' },
|
|
||||||
.desc = "Do not convert CP-command string to uppercase",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.option = { "buffer", required_argument, NULL, 'b' },
|
|
||||||
.argument = "SIZE",
|
|
||||||
.desc = "Specify buffer size in bytes, kilobytes (k) "
|
|
||||||
"or megabytes (M). SIZE range from 4096 to 1048576 "
|
|
||||||
"bytes"
|
|
||||||
},
|
|
||||||
UTIL_OPT_HELP,
|
|
||||||
UTIL_OPT_VERSION,
|
|
||||||
UTIL_OPT_END
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct util_prg prg = {
|
static const struct util_prg prg = {
|
||||||
.desc = "z/VM CP command interface",
|
.desc = "z/VM CP command interface",
|
||||||
.args = "CP-command",
|
.args = "CP-command",
|
||||||
|
|||||||
30
vmcp/vmcp_cli.h
Normal file
30
vmcp/vmcp_cli.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
/*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*
|
||||||
|
* Copyright IBM Corp.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef VMCP_CLI_H
|
||||||
|
#define VMCP_CLI_H
|
||||||
|
|
||||||
|
#include "lib/util_opt.h"
|
||||||
|
|
||||||
|
static struct util_opt opt_vec[] = {
|
||||||
|
UTIL_OPT_SECTION("OPTIONS"),
|
||||||
|
{
|
||||||
|
.option = { "keepcase", no_argument, NULL, 'k' },
|
||||||
|
.desc = "Do not convert CP-command string to uppercase",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.option = { "buffer", required_argument, NULL, 'b' },
|
||||||
|
.argument = "SIZE",
|
||||||
|
.desc = "Specify buffer size in bytes, kilobytes (k) "
|
||||||
|
"or megabytes (M). SIZE range from 4096 to 1048576 "
|
||||||
|
"bytes"
|
||||||
|
},
|
||||||
|
UTIL_OPT_HELP,
|
||||||
|
UTIL_OPT_VERSION,
|
||||||
|
UTIL_OPT_END
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user