[fix] Testing fixes
- sqlite error handling and wrapping - more responsive commands - database updates
This commit is contained in:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user