Skip to content

Commit fcc6492

Browse files
committed
dependency manager-agnostic naming
1 parent e48fd4a commit fcc6492

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

commands/operator-sdk/cmd/print_deps.go

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,23 @@ import (
2121
"github.com/spf13/cobra"
2222
)
2323

24-
var toml bool
24+
var asFile bool
2525

2626
func NewPrintDepsCmd() *cobra.Command {
2727
printDepsCmd := &cobra.Command{
2828
Use: "print-deps",
2929
Short: "Print dependencies expected by the Operator SDK",
3030
Long: `The operator-sdk print-deps command prints all dependencies expected by this
3131
version of the Operator SDK. Versions for these dependencies should match those
32-
in an operators' Gopkg.toml file.`,
32+
in an operators' Gopkg.toml file.
33+
34+
print-deps prints in columnar format by default. Use the --as-file flag to
35+
print in Gopkg.toml file format.
36+
`,
3337
Run: printDepsFunc,
3438
}
3539

36-
printDepsCmd.Flags().BoolVar(&toml, "toml", false, "Print dependencies in Gopkg.toml format.")
40+
printDepsCmd.Flags().BoolVar(&asFile, "as-file", false, "Print dependencies in Gopkg.toml file format.")
3741

3842
return printDepsCmd
3943
}
@@ -42,10 +46,10 @@ func printDepsFunc(cmd *cobra.Command, args []string) {
4246
if len(args) != 0 {
4347
log.Fatal("print-deps command does not take any arguments")
4448
}
45-
if toml {
46-
scaffold.PrintGopkgToml()
49+
if asFile {
50+
scaffold.PrintDepsAsFile()
4751
} else {
48-
if err := scaffold.PrintGopkgDeps(); err != nil {
52+
if err := scaffold.PrintDeps(); err != nil {
4953
log.Fatalf("print deps: (%v)", err)
5054
}
5155
}

pkg/scaffold/gopkgtoml.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ required = [
9797
non-go = false
9898
`
9999

100-
func PrintGopkgToml() {
100+
func PrintDepsAsFile() {
101101
fmt.Println(gopkgTomlTmpl)
102102
}
103103

104-
func PrintGopkgDeps() error {
104+
func PrintDeps() error {
105105
gopkgData := make(map[string]interface{})
106106
_, err := toml.Decode(gopkgTomlTmpl, &gopkgData)
107107
if err != nil {

0 commit comments

Comments
 (0)