Skip to content

Commit 5f95e9d

Browse files
committed
feat: add --dest-dir option to specify a destination directory of generated files
Example: $ query2app --lang python --dest-dir src $ find src 10:02 src src/requirements.txt src/app.py src/routes.py Fix #24
1 parent ed8f4ec commit 5f95e9d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/cli.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ const endpointsFile = 'endpoints.yaml';
1313

1414
const parseCommandLineArgs = (args) => {
1515
const opts = {
16-
'string': [ 'lang' ],
16+
// @todo #24 Document --dest-dir option
17+
'string': [ 'lang', 'dest-dir' ],
1718
'default': {
18-
'lang': 'js'
19+
'lang': 'js',
20+
'dest-dir': '.'
1921
}
2022
};
2123
const argv = parseArgs(args, opts);
@@ -268,6 +270,7 @@ const createDependenciesDescriptor = async (destDir, lang) => {
268270
console.log('Generate', fileName);
269271

270272
const resultFile = path.join(destDir, fileName);
273+
// @todo #24 [js] Possibly incorrect project name with --dest-dir option
271274
const projectName = path.basename(destDir);
272275
console.log('Project name:', projectName);
273276

@@ -308,7 +311,7 @@ afteward to run`)
308311
};
309312

310313
const absolutePathToDestDir = (argv) => {
311-
const relativeDestDir = argv._.length > 0 ? argv._[0] : '.'
314+
const relativeDestDir = argv._.length > 0 ? argv._[0] : argv['dest-dir']
312315
return path.resolve(process.cwd(), relativeDestDir)
313316
}
314317

0 commit comments

Comments
 (0)