Skip to content

Commit

Permalink
issue 142
Browse files Browse the repository at this point in the history
  • Loading branch information
J. F. Berghof III committed May 10, 2017
1 parent 473573c commit 96de3f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/builtin/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import (
)

var createCmd = func(sess cli.Session) *cobra.Command {
return &cobra.Command{
retval := &cobra.Command{
Use: "create <name>",
Short: "Create a command",
RunE: func(c *cobra.Command, args []string) error {
limit := billing.ContextPlan(sess.Context()).MaxCmds
cmds := store.Selected().List(sess.User())
flags := c.Flags()
if len(cmds) >= limit {
fmt.Fprintln(sess.Stderr(), "Command limit for plan reached")
sess.Exit(cli.StatusNoPerm)
Expand Down Expand Up @@ -49,6 +50,9 @@ var createCmd = func(sess cli.Session) *cobra.Command {
User: sess.User(),
Source: string(source),
}
if (flags.HasFlags() && c.Flags().Lookup("description") != nil) {

This comment has been minimized.

Copy link
@elimisteve

elimisteve May 10, 2017

Go style comment: the outer parens aren't needed :-)

cmd.Description = c.Flags().Lookup("description").Value.String()
}

if err := cmd.Build(); err != nil {
log.Info(err)
Expand All @@ -66,4 +70,6 @@ var createCmd = func(sess cli.Session) *cobra.Command {
return nil
},
}
}
cli.AddFlag(retval, cli.Flag{"description", "", "add descriptive text", "d", "string"})
return retval
}

0 comments on commit 96de3f8

Please sign in to comment.