Skip to content

Commit

Permalink
Name login arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
code-asher committed Oct 29, 2024
1 parent 763ea09 commit f6769a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,19 +136,19 @@ export class Commands {
* Log into the provided deployment. If the deployment URL is not specified,
* ask for it first with a menu showing recent URLs and CODER_URL, if set.
*/
public async login(...args: string[]): Promise<void> {
const url = await this.maybeAskUrl(args[0])
public async login([inputUrl, inputLabel, inputToken]: string[]): Promise<void> {
const url = await this.maybeAskUrl(inputUrl)
if (!url) {
return
}

// It is possible that we are trying to log into an old-style host, in which
// case we want to write with the provided blank label instead of generating
// a host label.
const label = typeof args[2] === "undefined" ? toSafeHost(url) : args[2]
const label = typeof inputLabel === "undefined" ? toSafeHost(url) : inputLabel

// Try to get a token from the user, if we need one, and their user.
const res = await this.maybeAskToken(url, args[1])
const res = await this.maybeAskToken(url, inputToken)
if (!res) {
return // The user aborted.
}
Expand Down

0 comments on commit f6769a3

Please sign in to comment.