Skip to content

Commit

Permalink
Add --dont-prettify option to user info commands
Browse files Browse the repository at this point in the history
  • Loading branch information
tmrts committed Jan 2, 2016
1 parent 8b04f86 commit 0bfd83e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion pkg/cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ var List = &cli.Command{
data = append(data, tmpl.Info().String())
}

tabular.Print([]string{"Tag", "Repository", "Created"}, data)
shouldntPrettify := GetBoolFlag(c, "dont-prettify")
if shouldntPrettify {
for _, name := range names {
fmt.Print(name, " ")
}
fmt.Println()
} else {
tabular.Print([]string{"Tag", "Repository", "Created"}, data)
}
},
}
1 change: 1 addition & 0 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func Run() {

Root.AddCommand(Template)

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

Root.Execute()
Expand Down
9 changes: 7 additions & 2 deletions pkg/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ import (
var Version = &cli.Command{
Use: "version",
Short: "Show the boilr version information",
Run: func(_ *cli.Command, args []string) {
Run: func(c *cli.Command, args []string) {
MustValidateArgs(args, []validate.Argument{})

tlog.Info(fmt.Sprint("Current version is ", boilr.Version))
shouldntPrettify := GetBoolFlag(c, "dont-prettify")
if shouldntPrettify {
fmt.Println(boilr.Version)
} else {
tlog.Info(fmt.Sprint("Current version is ", boilr.Version))
}
},
}

0 comments on commit 0bfd83e

Please sign in to comment.