From d9349e82e534ee9505752dcfeff0621de6d89290 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 31 Oct 2024 14:36:43 +0100 Subject: [PATCH] fix(cli): improve --instance handling wmill instance push --- cli/instance.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/cli/instance.ts b/cli/instance.ts index 9f3a8bd025..1e86282d1a 100644 --- a/cli/instance.ts +++ b/cli/instance.ts @@ -183,6 +183,7 @@ export type InstanceSyncOptions = { token?: string; folderPerInstance?: boolean; yes?: boolean; + prefix?: string; }; export async function pickInstance( @@ -202,7 +203,7 @@ export async function pickInstance( name: opts.instance, remote: opts.baseUrl, token: opts.token, - prefix: opts.instance, + prefix: opts.prefix ?? opts.instance, }; } if (opts.baseUrl && opts.token) { @@ -217,7 +218,7 @@ export async function pickInstance( name: "custom", remote: opts.baseUrl, token: opts.token, - prefix: "custom", + prefix: opts.prefix ?? "custom", }; } if (!allowNew && instances.length < 1) { @@ -448,8 +449,8 @@ async function instancePush(opts: GlobalOptions & InstanceSyncOptions) { const rootDir = Deno.cwd(); let localPrefix; - if (opts.baseUrl && opts.token) { - localPrefix = "custom"; + if (opts.prefix) { + localPrefix = opts.prefix; } else { localPrefix = (await Select.prompt({ message: "What is the prefix of the local workspaces you want to sync?", @@ -704,6 +705,11 @@ const command = new Command() "--instance ", "Name of the instance to pull from, override the active instance" ) + .option( + "--prefix ", + "Prefix of the local workspaces to pull, used to create the folders when using --include-workspaces" + ) + .action(instancePull as any) .command("push") .description( @@ -720,6 +726,10 @@ const command = new Command() "--instance ", "Name of the instance to push to, override the active instance" ) + .option( + "--prefix ", + "Prefix of the local workspaces folders to push" + ) .action(instancePush as any) .command("whoami") .description("Display information about the currently logged-in user")