Skip to content

Commit ed8f4ec

Browse files
committed
refactor: extract a method
Part of #24
1 parent 213b506 commit ed8f4ec

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/cli.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,16 @@ afteward to run`)
307307
}
308308
};
309309

310+
const absolutePathToDestDir = (argv) => {
311+
const relativeDestDir = argv._.length > 0 ? argv._[0] : '.'
312+
return path.resolve(process.cwd(), relativeDestDir)
313+
}
310314

311315
const argv = parseCommandLineArgs(process.argv.slice(2));
312316

313317
const config = loadConfig(endpointsFile);
314318

315-
let destDir = argv._.length > 0 ? argv._[0] : '.';
316-
destDir = path.resolve(process.cwd(), destDir);
319+
const destDir = absolutePathToDestDir(argv)
317320
console.log('Destination directory:', destDir)
318321

319322
if (!fs.existsSync(destDir)) {

0 commit comments

Comments
 (0)