Skip to content

Commit aef9ced

Browse files
clean login command
1 parent b7aee18 commit aef9ced

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

cli/src/commands/login.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { confirm, password } from '@inquirer/prompts';
1+
import { confirm, password, select } from '@inquirer/prompts';
22
import { ux } from '@oclif/core';
33
import { createAccountsHubClient, PowerSyncCommand, Services } from '@powersync/cli-core';
44
import { createServer } from 'node:http';
@@ -58,12 +58,15 @@ export default class Login extends PowerSyncCommand {
5858
}
5959
}
6060

61-
const shouldOpenBrowser = await confirm({
62-
message: 'Do you want to open the browser to create a new token?',
63-
default: false
61+
const tokenMethod = await select({
62+
message: 'How would you like to provide your token?',
63+
choices: [
64+
{ value: 'browser', name: 'Open a browser to generate a token' },
65+
{ value: 'existing', name: 'Enter an existing token' }
66+
]
6467
});
6568

66-
const token = shouldOpenBrowser
69+
const token = tokenMethod === 'browser'
6770
? await new Promise<string>((resolve, reject) => {
6871
const server = createServer();
6972
const spinner = ora('Waiting for you to create a token in the dashboard…').start();

0 commit comments

Comments
 (0)