Skip to content

Commit

Permalink
fix init local spec scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
cperaltah committed Oct 8, 2024
1 parent a76f3d2 commit 5ee2f61
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tools/tsp-client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export async function initCommand(argv: any) {
let outputDir = argv["output-dir"];
let tspConfig = argv["tsp-config"];
const skipSyncAndGenerate = argv["skip-sync-and-generate"];
const commit = argv["commit"];
const repo = argv["repo"];
const commit = argv["commit"] ?? "<replace with your value>";
const repo = argv["repo"] ?? "<replace with your value>";

const repoRoot = await getRepoRoot(outputDir);

Expand All @@ -40,16 +40,16 @@ export async function initCommand(argv: any) {
}

let isUrl = true;
if (await doesFileExist(tspConfig)) {
isUrl = false;
}
if (!isUrl) {
if (!commit || !repo) {
Logger.error("--commit and --repo are required when --tsp-config is a local directory");
process.exit(1);
if (argv["local-spec-repo"]) {
const localSpecRepo = argv["local-spec-repo"];
if (!(await doesFileExist(localSpecRepo))) {
throw new Error(`Local spec repo not found: ${localSpecRepo}`);
}
isUrl = false;
tspConfig = localSpecRepo;
} else if (await doesFileExist(tspConfig)) {
isUrl = false;
}

if (isUrl) {
// URL scenario
const resolvedConfigUrl = resolveTspConfigUrl(tspConfig);
Expand Down

0 comments on commit 5ee2f61

Please sign in to comment.