code-finder
Version:
CLI to detect codespaces and update IDE opened histories.
38 lines (36 loc) • 1.7 kB
JavaScript
import process from 'node:process';
import * as p from '@clack/prompts';
import c from 'ansis';
import { cac } from 'cac';
import { N as NAME, M as MODE_CHOICES, V as VERSION, e as executeCommand, l as capitalize } from './shared/code-finder.D3Cj8_Xk.mjs';
import 'tildify';
import 'pathe';
import 'node:fs';
import 'node:os';
import 'node:child_process';
import 'node:url';
import 'node:util';
import 'local-pkg';
import 'node:fs/promises';
import 'node:path';
try {
const cli = cac(NAME);
cli.command("[mode]", "CLI to detect codespaces and update IDE opened histories").option("--cwd <cwd>", "The path to be detected").option("--ignore-paths <paths...>", "Ignore the directories").option("--ide <ide>", "The IDE to be updated").option("--path", "Include the path to the histories").option("--tildify", "Convert and include the path to a tildify path").option("--git-branch", "The git branch to be detected").option("--source", "Include the source of the histories").option("--overwrite", "Overwrite the existing opened histories").option("--json", "Output the result in JSON format").option("--yes", "Skip the confirmation").action(async (mode, options) => {
if (mode) {
if (!MODE_CHOICES.includes(mode)) {
console.error(`Invalid mode: ${mode}. Please use one of the following: ${MODE_CHOICES.join(", ")}`);
process.exit(1);
}
options.mode = mode;
}
p.intro(`${c.yellow`${NAME} `}${c.dim`v${VERSION}`}`);
const { config } = await executeCommand(options);
p.outro(c.green`${capitalize(config.mode)} command completed`);
});
cli.help();
cli.version(VERSION);
cli.parse();
} catch (error) {
console.error(error);
process.exit(1);
}