fix(cli): improve --instance handling wmill instance push

This commit is contained in:
Ruben Fiszel
2024-10-31 14:36:43 +01:00
parent 833d9ad1bf
commit d9349e82e5
+14 -4
View File
@@ -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 <instance:string>",
"Name of the instance to pull from, override the active instance"
)
.option(
"--prefix <prefix:string>",
"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 <instance:string>",
"Name of the instance to push to, override the active instance"
)
.option(
"--prefix <prefix:string>",
"Prefix of the local workspaces folders to push"
)
.action(instancePush as any)
.command("whoami")
.description("Display information about the currently logged-in user")