Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion structures-js/structures-cli/src/commands/synchronize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class Synchronize extends Command {
server: Flags.string({char: 's', description: 'The structures server to connect to'}),
publish: Flags.boolean({char: 'p', description: 'Publish each Entity after save/update'}),
verbose: Flags.boolean({char: 'v', description: 'Enable verbose logging'}),
yes: Flags.boolean({description: 'Automatically confirm opening the browser'}),
dryRun: Flags.boolean({description: 'Dry run enables verbose logging and does not save any changes to the server'})
}

Expand All @@ -54,7 +55,7 @@ export class Synchronize extends Command {
serverUrl = serverConfig.url
}

if (flags.dryRun || await connectAndUpgradeSession(serverUrl, this)) {
if (flags.dryRun || await connectAndUpgradeSession(serverUrl, this, flags.yes)) {
try {

if(!flags.dryRun) {
Expand Down
5 changes: 3 additions & 2 deletions structures-js/structures-cli/src/internal/Utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ export function jsonStringifyReplacer(key: any, value: any) {
* This will be replaced when the server supports a session upgrade command
* @param server the server to connect to
* @param logger the logger to use
* @param autoConfirm allow the user to skip the browser confirmation
* @return true if the session was upgraded successfully
*/
export async function connectAndUpgradeSession(server: string, logger: Logger): Promise<boolean>{
export async function connectAndUpgradeSession(server: string, logger: Logger, autoConfirm?: boolean): Promise<boolean>{
try {
const serverURL: URL = new URL(server)

Expand Down Expand Up @@ -100,7 +101,7 @@ export async function connectAndUpgradeSession(server: string, logger: Logger):
logger.log('Authenticate your account at:')
logger.log(url)

const answer = await confirm({
const answer = autoConfirm ?? await confirm({
message: 'Open in browser?',
default: true,
})
Expand Down