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:
Szabina Korbai
2026-03-06 14:46:15 +01:00
committed by Jan Höppner
parent af99efaab2
commit 755ea88d5d
5 changed files with 55 additions and 18 deletions

2
.gitignore vendored
View File

@@ -115,6 +115,8 @@ tunedasd/src/tunedasd
tunedasd/src/_tunedasd
tunedasd/src/tunedasd.bash
vmcp/vmcp
vmcp/_vmcp
vmcp/vmcp.bash
vmur/vmur
zconf/chp/chchp
zconf/chp/lschp

View File

@@ -1,5 +1,10 @@
include ../common.mak
zsh-completions = _vmcp
bash-completions = vmcp.bash
include ../common_autocomp.mak
all: vmcp
libs = $(rootdir)/libvmcp/libvmcp.a $(rootdir)/libutil/libutil.a

View 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;
}

View File

@@ -36,6 +36,8 @@
#include "lib/util_opt.h"
#include "lib/util_prg.h"
#include "vmcp_cli.h"
#define MAXBUFFER 1048576
#define MINBUFFER 4096
#define MAXCMDLEN 240
@@ -50,24 +52,6 @@ static int keep_case = 0;
static int buffersize = VMCP_DEFAULT_BUFSZ;
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 = {
.desc = "z/VM CP command interface",
.args = "CP-command",

30
vmcp/vmcp_cli.h Normal file
View 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