Fix CLI arg routing and desktop install links

This commit is contained in:
Mohamed Boudra
2026-04-04 16:35:31 +07:00
parent c3313ff82a
commit d69fcb861d
9 changed files with 317 additions and 30 deletions
+25
View File
@@ -18,6 +18,31 @@ export function isPathLikeArg(arg: string): boolean {
);
}
export function isExistingDirectoryArg(arg: string): boolean {
const absolutePath = path.resolve(expandUserPath(arg));
if (!existsSync(absolutePath)) {
return false;
}
return statSync(absolutePath).isDirectory();
}
export function shouldOpenProjectArg(input: {
arg: string;
knownCommands: ReadonlySet<string>;
}): boolean {
if (input.arg.startsWith("-")) {
return false;
}
if (input.knownCommands.has(input.arg)) {
return false;
}
return isPathLikeArg(input.arg) || isExistingDirectoryArg(input.arg);
}
function expandUserPath(inputPath: string): string {
if (inputPath === "~") {
return homedir();