feat(cli): added --confirm/-c argument when deleting users to bypass prompt (#86)
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
|
userFlagEnableUser bool
|
||||||
userFlagDisableUser bool
|
userFlagDisableUser bool
|
||||||
userFlagDeleteNow bool
|
userFlagDeleteNow bool
|
||||||
|
userFlagDeleteConfirm bool
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -73,6 +74,9 @@ func init() {
|
|||||||
// User deletion flags
|
// User deletion flags
|
||||||
userDeleteCmd.Flags().BoolVarP(&userFlagDeleteNow, "now", "n", false, "If provided, deletes the user immediately instead of sending them an email first.")
|
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)
|
userCmd.AddCommand(userListCmd, userCreateCmd, userUpdateCmd, userResetPasswordCmd, userChangeEnabledCmd, userDeleteCmd)
|
||||||
rootCmd.AddCommand(userCmd)
|
rootCmd.AddCommand(userCmd)
|
||||||
}
|
}
|
||||||
@ -326,7 +330,7 @@ var userDeleteCmd = &cobra.Command{
|
|||||||
initialize.FullInit()
|
initialize.FullInit()
|
||||||
},
|
},
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
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("You requested to delete the user immediately. Are you sure?")
|
||||||
fmt.Println(`To confirm, please type "yes, I confirm" in all uppercase:`)
|
fmt.Println(`To confirm, please type "yes, I confirm" in all uppercase:`)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user