Skip to content

Commit 80f932c

Browse files
Skip interactive prompts when PAT is provided
- Move PAT check before token expiry and re-auth prompts in login flow - Add common entries to .gitignore (bin/, .env*, .DS_Store, IDE files)
1 parent 354bc41 commit 80f932c

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

.gitignore

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,19 @@ cover.out
1616
completions
1717

1818
.vscode
19+
20+
# Build artifacts
21+
bin/
22+
23+
# Environment files
24+
.env*
25+
26+
# OS metadata
27+
.DS_Store
28+
Thumbs.db
29+
30+
# IDE/editor files
31+
.idea/
32+
*.swp
33+
*.swo
34+
*~

command/auth/login/login.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ func (opts *LoginOptions) Run() (err error) {
119119
cfg.Host = config.DefaultHostName
120120
}
121121

122+
// If PAT is passed, start the login flow through PAT (skip interactive prompts)
123+
if opts.PAT != "" {
124+
return opts.startPATLoginFlow(svc, cfg, opts.PAT)
125+
}
126+
122127
// Before starting the login workflow, check here for two conditions:
123128
// Condition 1 : If the token has expired, display a message about it and re-authenticate user
124129
// Condition 2 : If the token has not expired,does the user want to re-authenticate?
@@ -138,11 +143,6 @@ func (opts *LoginOptions) Run() (err error) {
138143
}
139144
}
140145

141-
// If PAT is passed, start the login flow through PAT
142-
if opts.PAT != "" {
143-
return opts.startPATLoginFlow(svc, cfg, opts.PAT)
144-
}
145-
146146
// Condition 2
147147
// `startLoginFlow` implements the authentication flow for the CLI
148148
return opts.startLoginFlow(svc, cfg)

0 commit comments

Comments
 (0)