mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
fix: secrets remove not updating local store and return error when not found
This commit is contained in:
parent
0333caa403
commit
6ae0121af7
1 changed files with 10 additions and 1 deletions
|
|
@ -203,13 +203,22 @@ var secretsRemoveCmd = &cobra.Command{
|
|||
Short: "Remove secrets by IDs from secret store.",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
for _, secretID := range args {
|
||||
// open secret store from file
|
||||
store, err := secrets.OpenStore(secretsFile)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
store.RemoveSecretByID(secretID)
|
||||
// remove secret from store by it's ID
|
||||
err = store.RemoveSecretByID(secretID)
|
||||
if err != nil {
|
||||
fmt.Println("failed to remove secret: ", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// update store by saving to original file
|
||||
secrets.SaveSecrets(secretsFile, store.(*secrets.LocalSecretStore).Secrets)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue