hc user delete: ask first, and take -y
It deleted the user and their tokens at once, while every other delete asks and takes -y/--yes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
04e623daa1
commit
c3bd128778
2 files changed
+10
-2
No files matched your search
@@ -106,6 +106,8 @@ All notable changes to Housecarl are documented here. The format follows
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- `hc user delete` asks first, as every other delete does, and takes
|
||||||
|
`-y`/`--yes` not to; it deleted the user and their tokens at once.
|
||||||
- The ruleset's diff (Changes, `hc changeset diff`, `--dry-run`) names
|
- The ruleset's diff (Changes, `hc changeset diff`, `--dry-run`) names
|
||||||
the chain each part is in on its `@@` line (`@@ -40,6 +40,8 @@ chain
|
the chain each part is in on its `@@` line (`@@ -40,6 +40,8 @@ chain
|
||||||
forward`), as `git diff` names the function, so a rule added deep in a
|
forward`), as `git diff` names the function, so a rule added deep in a
|
||||||
|
|||||||
+8
-2
@@ -349,9 +349,13 @@ operator, log) or grants such as --grant config:read --grant sets:write:guests.
|
|||||||
f.BoolVar(&enable, "enable", false, "enable the user again")
|
f.BoolVar(&enable, "enable", false, "enable the user again")
|
||||||
f.StringVar(&comment, "comment", "", "a comment")
|
f.StringVar(&comment, "comment", "", "a comment")
|
||||||
cmd.AddCommand(update)
|
cmd.AddCommand(update)
|
||||||
cmd.AddCommand(&cobra.Command{
|
var yes bool
|
||||||
|
del := &cobra.Command{
|
||||||
Use: "delete USER", Short: "Delete a user and their tokens", Args: cobra.ExactArgs(1),
|
Use: "delete USER", Short: "Delete a user and their tokens", Args: cobra.ExactArgs(1),
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
|
if !confirm(fmt.Sprintf("Delete user %s and their tokens?", args[0]), yes) {
|
||||||
|
return fmt.Errorf("not deleted")
|
||||||
|
}
|
||||||
id, err := userID(args[0])
|
id, err := userID(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -365,7 +369,9 @@ operator, log) or grants such as --grant config:read --grant sets:write:guests.
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
})
|
}
|
||||||
|
del.Flags().BoolVarP(&yes, "yes", "y", false, "don't ask")
|
||||||
|
cmd.AddCommand(del)
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user