diff options
Diffstat (limited to 'commands')
-rw-r--r-- | commands/add.go (renamed from commands/new.go) | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/commands/new.go b/commands/add.go index 0d68ffd8..3fa75f26 100644 --- a/commands/new.go +++ b/commands/add.go @@ -9,16 +9,16 @@ import ( ) var ( - newTitle string - newMessage string - newMessageFile string + addTitle string + addMessage string + addMessageFile string ) -func runNewBug(cmd *cobra.Command, args []string) error { +func runAddBug(cmd *cobra.Command, args []string) error { var err error - if newMessageFile != "" && newMessage == "" { - newMessage, err = input.FromFile(newMessageFile) + if addMessageFile != "" && addMessage == "" { + addMessage, err = input.FromFile(addMessageFile) if err != nil { return err } @@ -30,8 +30,8 @@ func runNewBug(cmd *cobra.Command, args []string) error { } defer backend.Close() - if newMessage == "" || newTitle == "" { - newTitle, newMessage, err = input.BugCreateEditorInput(backend.Repository(), newTitle, newMessage) + if addMessage == "" || addTitle == "" { + addTitle, addMessage, err = input.BugCreateEditorInput(backend.Repository(), addTitle, addMessage) if err == input.ErrEmptyTitle { fmt.Println("Empty title, aborting.") @@ -42,7 +42,7 @@ func runNewBug(cmd *cobra.Command, args []string) error { } } - b, err := backend.NewBug(newTitle, newMessage) + b, err := backend.NewBug(addTitle, addMessage) if err != nil { return err } @@ -52,24 +52,24 @@ func runNewBug(cmd *cobra.Command, args []string) error { return nil } -var newCmd = &cobra.Command{ - Use: "new", +var addCmd = &cobra.Command{ + Use: "add", Short: "Create a new bug", - RunE: runNewBug, + RunE: runAddBug, } func init() { - RootCmd.AddCommand(newCmd) + RootCmd.AddCommand(addCmd) - newCmd.Flags().SortFlags = false + addCmd.Flags().SortFlags = false - newCmd.Flags().StringVarP(&newTitle, "title", "t", "", + addCmd.Flags().StringVarP(&addTitle, "title", "t", "", "Provide a title to describe the issue", ) - newCmd.Flags().StringVarP(&newMessage, "message", "m", "", + addCmd.Flags().StringVarP(&addMessage, "message", "m", "", "Provide a message to describe the issue", ) - newCmd.Flags().StringVarP(&newMessageFile, "file", "F", "", + addCmd.Flags().StringVarP(&addMessageFile, "file", "F", "", "Take the message from the given file. Use - to read the message from the standard input", ) } |