feat(cli): added --confirm/-c argument when deleting users to bypass prompt (#86)
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Reviewed-On: https://github.com/go-vikunja/api/pull/86
This commit is contained in:
parent
332a7403ed
commit
0769d59054
@ -46,6 +46,7 @@ var (
|
||||
userFlagEnableUser bool
|
||||
userFlagDisableUser bool
|
||||
userFlagDeleteNow bool
|
||||
userFlagDeleteConfirm bool
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -73,6 +74,9 @@ func init() {
|
||||
// User deletion flags
|
||||
userDeleteCmd.Flags().BoolVarP(&userFlagDeleteNow, "now", "n", false, "If provided, deletes the user immediately instead of sending them an email first.")
|
||||
|
||||
// Bypass confirm prompt
|
||||
userDeleteCmd.Flags().BoolVarP(&userFlagDeleteConfirm, "confirm", "c", false, "Bypasses any prompts confirming the deletion request, use with caution!")
|
||||
|
||||
userCmd.AddCommand(userListCmd, userCreateCmd, userUpdateCmd, userResetPasswordCmd, userChangeEnabledCmd, userDeleteCmd)
|
||||
rootCmd.AddCommand(userCmd)
|
||||
}
|
||||
@ -326,7 +330,7 @@ var userDeleteCmd = &cobra.Command{
|
||||
initialize.FullInit()
|
||||
},
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
if userFlagDeleteNow {
|
||||
if userFlagDeleteNow && !userFlagDeleteConfirm {
|
||||
fmt.Println("You requested to delete the user immediately. Are you sure?")
|
||||
fmt.Println(`To confirm, please type "yes, I confirm" in all uppercase:`)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user