Skip to content

Commit c11fd15

Browse files
committed
remove prompt
1 parent 2949164 commit c11fd15

File tree

3 files changed

+2
-47
lines changed

3 files changed

+2
-47
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
coder v0.0.0-devel
22

33
USAGE:
4-
coder tokens remove [flags] <name|id|token>
4+
coder tokens remove <name|id|token>
55

66
Delete a token
77

88
Aliases: delete, rm
99

10-
OPTIONS:
11-
-y, --yes bool
12-
Bypass prompts.
13-
1410
———
1511
Run `coder --help` for a list of global options.

cli/tokens.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111

1212
"github.com/coder/coder/v2/cli/cliui"
1313
"github.com/coder/coder/v2/codersdk"
14-
"github.com/coder/pretty"
1514
"github.com/coder/serpent"
1615
)
1716

@@ -232,9 +231,6 @@ func (r *RootCmd) removeToken() *serpent.Command {
232231
serpent.RequireNArgs(1),
233232
r.InitClient(client),
234233
),
235-
Options: serpent.OptionSet{
236-
cliui.SkipPromptOption(),
237-
},
238234
Handler: func(inv *serpent.Invocation) error {
239235
token, err := client.APIKeyByName(inv.Context(), codersdk.Me, inv.Args[0])
240236
if err != nil {
@@ -246,33 +242,6 @@ func (r *RootCmd) removeToken() *serpent.Command {
246242
}
247243
}
248244

249-
var prompt string
250-
if token.TokenName == "" {
251-
prompt = fmt.Sprintf("Are you sure you want to delete the token with ID %s?\n ",
252-
pretty.Sprint(cliui.DefaultStyles.Code, token.ID),
253-
)
254-
} else {
255-
prompt = fmt.Sprintf("Are you sure you want to delete the token with the name %s? (ID: %s)\n ",
256-
pretty.Sprint(cliui.DefaultStyles.Code, token.TokenName),
257-
pretty.Sprint(cliui.DefaultStyles.Code, token.ID),
258-
)
259-
}
260-
261-
if !token.LastUsed.IsZero() {
262-
prompt = fmt.Sprintf("%sIt was last used on %s.", prompt, pretty.Sprint(cliui.DefaultStyles.Code, token.LastUsed.String()))
263-
} else {
264-
prompt = fmt.Sprintf("%sIt has never been used.", prompt)
265-
}
266-
267-
_, err = cliui.Prompt(inv, cliui.PromptOptions{
268-
Text: prompt,
269-
IsConfirm: true,
270-
Default: cliui.ConfirmYes,
271-
})
272-
if err != nil {
273-
return err
274-
}
275-
276245
err = client.DeleteAPIKey(inv.Context(), codersdk.Me, token.ID)
277246
if err != nil {
278247
return xerrors.Errorf("delete api key: %w", err)

docs/reference/cli/tokens_remove.md

Lines changed: 1 addition & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy