@@ -19,15 +19,15 @@ func DeleteCmd(ch *cmdutil.Helper) *cobra.Command {
19
19
var force bool
20
20
21
21
cmd := & cobra.Command {
22
- Use : "delete <database> <branch> <password>" ,
22
+ Use : "delete <database> <branch> <password-id >" ,
23
23
Short : "Delete a branch password" ,
24
- Args : cmdutil .RequiredArgs ("database" , "branch" , "password" ),
24
+ Args : cmdutil .RequiredArgs ("database" , "branch" , "password-id " ),
25
25
Aliases : []string {"rm" },
26
26
RunE : func (cmd * cobra.Command , args []string ) error {
27
27
ctx := cmd .Context ()
28
28
database := args [0 ]
29
29
branch := args [1 ]
30
- password := args [2 ]
30
+ passwordId := args [2 ]
31
31
32
32
client , err := ch .Client ()
33
33
if err != nil {
@@ -39,7 +39,7 @@ func DeleteCmd(ch *cmdutil.Helper) *cobra.Command {
39
39
return fmt .Errorf ("cannot delete password with the output format %q (run with -force to override)" , ch .Printer .Format ())
40
40
}
41
41
42
- confirmationName := fmt .Sprintf ("%s/%s/%s" , database , branch , password )
42
+ confirmationName := fmt .Sprintf ("%s/%s/%s" , database , branch , passwordId )
43
43
if ! printer .IsTTY {
44
44
return fmt .Errorf ("cannot confirm deletion of password %q (run with -force to override)" , confirmationName )
45
45
}
@@ -67,20 +67,20 @@ func DeleteCmd(ch *cmdutil.Helper) *cobra.Command {
67
67
}
68
68
69
69
end := ch .Printer .PrintProgress (fmt .Sprintf ("Deleting password %s from %s/%s" ,
70
- printer .BoldBlue (password ), printer .BoldBlue (database ), printer .BoldBlue (branch )))
70
+ printer .BoldBlue (passwordId ), printer .BoldBlue (database ), printer .BoldBlue (branch )))
71
71
defer end ()
72
72
73
73
err = client .Passwords .Delete (ctx , & ps.DeleteDatabaseBranchPasswordRequest {
74
74
Organization : ch .Config .Organization ,
75
75
Database : database ,
76
76
Branch : branch ,
77
- PasswordId : password ,
77
+ PasswordId : passwordId ,
78
78
})
79
79
if err != nil {
80
80
switch cmdutil .ErrCode (err ) {
81
81
case ps .ErrNotFound :
82
82
return fmt .Errorf ("password %s does not exist in branch %s of %s (organization: %s)" ,
83
- printer .BoldBlue (password ), printer .BoldBlue (branch ), printer .BoldBlue (database ), printer .BoldBlue (ch .Config .Organization ))
83
+ printer .BoldBlue (passwordId ), printer .BoldBlue (branch ), printer .BoldBlue (database ), printer .BoldBlue (ch .Config .Organization ))
84
84
default :
85
85
return cmdutil .HandleError (err )
86
86
}
@@ -90,15 +90,15 @@ func DeleteCmd(ch *cmdutil.Helper) *cobra.Command {
90
90
91
91
if ch .Printer .Format () == printer .Human {
92
92
ch .Printer .Printf ("Password %s was successfully deleted from %s.\n " ,
93
- printer .BoldBlue (password ), printer .BoldBlue (branch ))
93
+ printer .BoldBlue (passwordId ), printer .BoldBlue (branch ))
94
94
return nil
95
95
}
96
96
97
97
return ch .Printer .PrintResource (
98
98
map [string ]string {
99
- "result" : "password deleted" ,
100
- "password " : password ,
101
- "branch" : branch ,
99
+ "result" : "password deleted" ,
100
+ "password_id " : passwordId ,
101
+ "branch" : branch ,
102
102
},
103
103
)
104
104
},
0 commit comments