summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--WHATS_NEW1
-rw-r--r--tools/args.h2
-rw-r--r--tools/command.c1
-rw-r--r--tools/lvmcmdline.c9
-rw-r--r--tools/tools.h1
5 files changed, 13 insertions, 1 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 90dd417b1..9e7cd1f0c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.17 -
===============================
+ Error out in lvm shell if using a cmd argument not supported in the shell.
Fix lvm shell's lastlog command to report previous pre-command failures.
Extend VDO and VDOPOOL without flushing and locking fs.
Add --valuesonly option to lvmconfig to print only values without keys.
diff --git a/tools/args.h b/tools/args.h
index bdeefca7d..85dd11aeb 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -671,7 +671,7 @@ arg(replace_ARG, '\0', "replace", pv_VAL, ARG_GROUPABLE, 0,
"Multiple PVs can be replaced by repeating this option.\n"
"See \\fBlvmraid\\fP(7) for more information.\n")
-arg(reportformat_ARG, '\0', "reportformat", reportformat_VAL, 0, 0,
+arg(reportformat_ARG, '\0', "reportformat", reportformat_VAL, ARG_NONINTERACTIVE, 0,
"Overrides current output format for reports which is defined globally by\n"
"the report/output_format setting in \\fBlvm.conf\\fP(5).\n"
"\\fBbasic\\fP is the original format with columns and rows.\n"
diff --git a/tools/command.c b/tools/command.c
index 8de8825e4..5da511530 100644
--- a/tools/command.c
+++ b/tools/command.c
@@ -78,6 +78,7 @@ static void *dm_pool_alloc(void *p, size_t size)
/* needed to include args.h */
#define ARG_COUNTABLE 0x00000001
#define ARG_GROUPABLE 0x00000002
+#define ARG_NONINTERACTIVE 0x00000004
struct cmd_context;
struct arg_values;
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4fb21074f..ba3ca220b 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -2261,6 +2261,15 @@ static int _process_command_line(struct cmd_context *cmd, int *argc, char ***arg
av = &cmd->opt_arg_values[arg_enum];
+ if (a->flags & ARG_NONINTERACTIVE && cmd->is_interactive) {
+ log_error("Argument%s%c%s%s cannot be used in interactive mode.",
+ a->short_opt ? " -" : "",
+ a->short_opt ? : ' ',
+ (a->short_opt && a->long_opt) ?
+ "/" : "", a->long_opt ? : "");
+ return 0;
+ }
+
if (a->flags & ARG_GROUPABLE) {
/*
* Start a new group of arguments:
diff --git a/tools/tools.h b/tools/tools.h
index cd89e1692..2636c22da 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -96,6 +96,7 @@ enum {
#define ARG_COUNTABLE 0x00000001 /* E.g. -vvvv */
#define ARG_GROUPABLE 0x00000002 /* E.g. --addtag */
+#define ARG_NONINTERACTIVE 0x00000004 /* only for use in noninteractive mode */
struct arg_values {
unsigned count;