Skip to content

Commit

Permalink
(shell): Switch from flag.StringVarP to flag.StringP
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinGimbel committed Aug 8, 2017
1 parent 027e10e commit f9c48f2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func findTemplate(path string) string {

func main() {
var (
completionFlag string
generatorsFlag = flag.BoolP("generators", "G", false, "lists available generators")
generatorFlag = flag.StringP("generator", "g", "", "show help for a specific generator")
constraintsFlag = flag.BoolP("generators-with-constraints", "c", false, "lists available generators with constraints")
Expand All @@ -91,17 +90,17 @@ func main() {
versionFlag = flag.BoolP("version", "v", false, "shows version information")
tableFlag = flag.StringP("table", "t", "TABLE", "table name of the sql format")
templateFlag = flag.StringP("template", "T", "", "Use template as input")
completionFlag = flag.StringP("completion", "C", "", "print bash/zsh completion function, pass shell as argument (\"bash\" or \"zsh\")")
)
flag.StringVarP(&completionFlag, "completion", "C", "", "print bash/zsh completion function, pass shell as argument (\"bash\" or \"zsh\")")

flag.Usage = func() {
fmt.Fprintf(os.Stdout, "Usage: fakedata [option ...] field...\n\n")
flag.PrintDefaults()
}
flag.Parse()

if completionFlag != "" {
completion, err := fakedata.PrintShellCompletionFunction(completionFlag)
if *completionFlag != "" {
completion, err := fakedata.PrintShellCompletionFunction(*completionFlag)
if err != nil {
fmt.Println(err)
}
Expand Down

0 comments on commit f9c48f2

Please sign in to comment.