Skip to content

Commit 0bfd83e

Browse files
committed
Add --dont-prettify option to user info commands
1 parent 8b04f86 commit 0bfd83e

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

pkg/cmd/list.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ var List = &cli.Command{
7171
data = append(data, tmpl.Info().String())
7272
}
7373

74-
tabular.Print([]string{"Tag", "Repository", "Created"}, data)
74+
shouldntPrettify := GetBoolFlag(c, "dont-prettify")
75+
if shouldntPrettify {
76+
for _, name := range names {
77+
fmt.Print(name, " ")
78+
}
79+
fmt.Println()
80+
} else {
81+
tabular.Print([]string{"Tag", "Repository", "Created"}, data)
82+
}
7583
},
7684
}

pkg/cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func Run() {
4747

4848
Root.AddCommand(Template)
4949

50+
Version.PersistentFlags().BoolP("dont-prettify", "", false, "Only print the version without fancy formatting")
5051
Root.AddCommand(Version)
5152

5253
Root.Execute()

pkg/cmd/version.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,14 @@ import (
1414
var Version = &cli.Command{
1515
Use: "version",
1616
Short: "Show the boilr version information",
17-
Run: func(_ *cli.Command, args []string) {
17+
Run: func(c *cli.Command, args []string) {
1818
MustValidateArgs(args, []validate.Argument{})
1919

20-
tlog.Info(fmt.Sprint("Current version is ", boilr.Version))
20+
shouldntPrettify := GetBoolFlag(c, "dont-prettify")
21+
if shouldntPrettify {
22+
fmt.Println(boilr.Version)
23+
} else {
24+
tlog.Info(fmt.Sprint("Current version is ", boilr.Version))
25+
}
2126
},
2227
}

0 commit comments

Comments
 (0)