[PATCH 17/23] vsh: Require that positional non-argv arguments are required

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is logically enforced by existing checks, thus we can formalize it.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 tools/vsh.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/vsh.c b/tools/vsh.c
index 7091cf093c..301fa9d747 100644
--- a/tools/vsh.c
+++ b/tools/vsh.c
@@ -329,6 +329,13 @@ vshCmddefCheckInternals(vshControl *ctl,
             }
         }

+        /* require that positional non-argv options are required */
+        if (opt->positional && !opt->required && opt->type != VSH_OT_ARGV) {
+            vshError(ctl, "positional argument '%s' of command '%s' must be required",
+                     opt->name, cmd->name);
+            return -1;
+        }
+
         switch (opt->type) {
         case VSH_OT_NONE:
             vshError(ctl, "invalid type 'NONE' of option '%s' of command '%s'",
-- 
2.44.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux