[fix] Testing fixes

- sqlite error handling and wrapping
- more responsive commands
- database updates
This commit is contained in:
2025-06-19 17:23:17 -04:00
parent 0d7fbffaf6
commit 7ff43c82c2
15 changed files with 112 additions and 40 deletions

View File

@@ -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")
},
}