From 56d3c2c5556a46d14e8639e4ac309b5947912cdb Mon Sep 17 00:00:00 2001 From: filifa Date: Mon, 2 Sep 2024 22:52:54 -0500 Subject: [PATCH] make -p and -s mutually exclusive --- cmd/root.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 8a24142..f407e81 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -127,6 +127,8 @@ func init() { // Cobra also supports local flags, which will only run // when this action is called directly. - rootCmd.Flags().StringVarP(&preset, "preset", "p", "", "Preset file to use") - rootCmd.Flags().StringVarP(&scriptPath, "script", "s", "", "Script file to use") + rootCmd.Flags().StringVarP(&preset, "preset", "p", "", "preset file to use") + rootCmd.Flags().StringVarP(&scriptPath, "script", "s", "", "script file to use") + + rootCmd.MarkFlagsMutuallyExclusive("preset", "script") }