[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

@@ -15,9 +15,10 @@ import (
)
var updateCmd = &cobra.Command{
Use: "update",
Example: "mctl server update <name>",
Short: "updates a saved servers password in the database",
Use: "update",
Example: "mctl server update <name>",
Short: "updates a saved servers password in the database",
SilenceUsage: true,
Run: func(cmd *cobra.Command, args []string) {
//read in password using term to keep it secure/hidden from bash history
fmt.Printf("Password: ")
@@ -29,6 +30,10 @@ var updateCmd = &cobra.Command{
defer db.Close()
err = db.UpdateServer(args[0], base64.StdEncoding.EncodeToString(ps))
if err.Error() == ErrInit {
fmt.Println(ErrInitRsp)
return
}
cobra.CheckErr(err)
fmt.Printf("%s password updated!", args[0])