fix: improve trans script migration hint
This commit is contained in:
+8
-1
@@ -7,13 +7,20 @@ import { runSsh } from "./src/ssh";
|
||||
|
||||
const remoteOptions = extractRemoteCliOptions(process.argv.slice(2));
|
||||
const args = normalizeSshCommandArgs(remoteOptions.args);
|
||||
const commandName = args.join(" ") || "ssh";
|
||||
const commandName = displayCommandName(args);
|
||||
|
||||
function normalizeSshCommandArgs(rawArgs: string[]): string[] {
|
||||
if (rawArgs[0] === "ssh") return rawArgs;
|
||||
return ["ssh", ...rawArgs];
|
||||
}
|
||||
|
||||
function displayCommandName(normalizedArgs: string[]): string {
|
||||
const rawEntrypoint = process.env.UNIDESK_SSH_ENTRYPOINT?.trim();
|
||||
const entrypoint = rawEntrypoint === "trans" || rawEntrypoint === "tran" || rawEntrypoint === "ssh" ? rawEntrypoint : "ssh";
|
||||
const displayArgs = normalizedArgs[0] === "ssh" ? normalizedArgs.slice(1) : normalizedArgs;
|
||||
return [entrypoint, ...displayArgs].join(" ") || entrypoint;
|
||||
}
|
||||
|
||||
function isGhContentRouteTarget(target: string | undefined): boolean {
|
||||
return typeof target === "string" && target.startsWith("gh:");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user