Skip to content

Commit 109ad0b

Browse files
committed
flags file
1 parent dc4e4f2 commit 109ad0b

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

internal/cli/clu2adv/clu2adv.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package clu2adv
22

33
import (
4+
"github.com/mongodb-labs/atlas-cli-plugin-terraform/internal/flag"
45
"github.com/spf13/afero"
56
"github.com/spf13/cobra"
67
)
@@ -19,11 +20,12 @@ func Builder() *cobra.Command {
1920
return o.Run()
2021
},
2122
}
22-
cmd.Flags().StringVarP(&o.file, "file", "f", "", "input file")
23-
_ = cmd.MarkFlagRequired("file")
24-
cmd.Flags().StringVarP(&o.output, "output", "o", "", "output file")
25-
_ = cmd.MarkFlagRequired("output")
26-
cmd.Flags().BoolVarP(&o.replaceOutput, "replaceOutput", "r", false, "replace output file if exists")
27-
cmd.Flags().BoolVarP(&o.watch, "watch", "w", false, "keeps the plugin running and watches the input file for changes")
23+
cmd.Flags().StringVarP(&o.file, flag.File, flag.FileShort, "", "input file")
24+
_ = cmd.MarkFlagRequired(flag.File)
25+
cmd.Flags().StringVarP(&o.output, flag.Output, flag.OutputShort, "", "output file")
26+
_ = cmd.MarkFlagRequired(flag.Output)
27+
cmd.Flags().BoolVarP(&o.replaceOutput, flag.ReplaceOutput, flag.ReplaceOutputShort, false, "replace output file if exists")
28+
cmd.Flags().BoolVarP(&o.watch, flag.Watch, flag.WatchShort, false, "keeps the plugin running and watches the input file for changes")
29+
cmd.Flags().BoolVarP(&o.includeMoved, flag.IncludeMoved, flag.IncludeMovedShort, false, "include moved blocks in the output file")
2830
return cmd
2931
}

internal/flag/flags.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package flag
2+
3+
const (
4+
File = "file"
5+
FileShort = "f"
6+
Output = "output"
7+
OutputShort = "o"
8+
ReplaceOutput = "replaceOutput"
9+
ReplaceOutputShort = "r"
10+
Watch = "watch"
11+
WatchShort = "w"
12+
IncludeMoved = "includeMoved"
13+
IncludeMovedShort = "m"
14+
)

0 commit comments

Comments
 (0)