Skip to content

Commit 97a6a73

Browse files
committed
Add "wrap" argument
1 parent 986b58f commit 97a6a73

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

src/bin.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ yargs
2424
.command({
2525
command: '*',
2626
handler: (args: IArgs) => {
27-
const { directory } = args;
27+
const { directory, wrap } = args;
2828

29-
runGenerator({ directory })
29+
runGenerator({ directory, wrap })
3030
.then(() => process.exit(0))
3131
.catch(err => {
3232
Logger.error(err);
3333
process.exit(1);
3434
});
3535
},
3636
})
37+
.option('wrap', {
38+
type: 'boolean',
39+
description: 'Wrap generated files in folder',
40+
})
3741
.option('directory', {
3842
alias: 'd',
3943
type: 'string',

src/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ import { FileGenerateManager } from './core/FileGenerateManager';
88
import { CONFIG } from './constants';
99

1010
export interface IArgs {
11+
wrap?: boolean;
1112
directory?: string;
1213
}
1314

1415
export async function runGenerator(args: IArgs) {
15-
const { directory } = args;
16+
const { directory, wrap } = args;
1617
const { type } = await inquirer.prompt(typeQuestion as any);
1718

1819
process.stdout.write('\n');
@@ -21,6 +22,10 @@ export async function runGenerator(args: IArgs) {
2122
CONFIG.path = path.resolve(process.cwd(), directory);
2223
}
2324

25+
if (wrap != null) {
26+
CONFIG.wrapFolder = wrap;
27+
}
28+
2429
switch (type) {
2530
case 'component': {
2631
const answers = await inquirer.prompt(questionTypes.getComponentQuestions());

0 commit comments

Comments
 (0)