[fix] Testing fixes
- sqlite error handling and wrapping - more responsive commands - database updates
This commit is contained in:
@@ -13,9 +13,10 @@ import (
|
||||
)
|
||||
|
||||
var addCmd = &cobra.Command{
|
||||
Use: "add",
|
||||
Example: "mctl command add",
|
||||
Short: "Saves a new command to the database",
|
||||
Use: "add",
|
||||
Example: "mctl command add",
|
||||
Short: "Saves a new command to the database",
|
||||
SilenceUsage: true,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
scanner := bufio.NewScanner(os.Stdin)
|
||||
|
||||
@@ -40,7 +41,13 @@ var addCmd = &cobra.Command{
|
||||
cobra.CheckErr(err)
|
||||
|
||||
err = db.SaveCmd(cfgname, cfgcmd)
|
||||
if err.Error() == ErrInit {
|
||||
fmt.Println(ErrInitRsp)
|
||||
return
|
||||
}
|
||||
cobra.CheckErr(err)
|
||||
|
||||
fmt.Println("Command saved")
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user