-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathcli-args.ts
More file actions
53 lines (52 loc) · 1.42 KB
/
Copy pathcli-args.ts
File metadata and controls
53 lines (52 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import yargs, { type Argv } from 'yargs';
import { parsePluginSlugs, validatePluginSlugs } from './plugins.js';
import {
CI_PROVIDERS,
CONFIG_FILE_FORMATS,
type PluginSetupBinding,
SETUP_MODES,
} from './types.js';
export function yargsCli(bindings: PluginSetupBinding[]): Argv {
return yargs()
.scriptName('create-cli')
.usage('$0 [options]')
.parserConfiguration({ 'dot-notation': false })
.option('dry-run', {
type: 'boolean',
default: false,
describe: 'Preview changes without writing files',
})
.option('yes', {
alias: 'y',
type: 'boolean',
default: false,
describe: 'Skip prompts and use defaults',
})
.option('config-format', {
type: 'string',
choices: CONFIG_FILE_FORMATS,
describe: 'Config file format (default: auto-detected from project)',
})
.option('plugins', {
type: 'string',
describe:
'Comma-separated plugin slugs to include (e.g. eslint,coverage)',
coerce: parsePluginSlugs,
})
.option('mode', {
type: 'string',
choices: SETUP_MODES,
describe: 'Setup mode (default: auto-detected from project)',
})
.option('ci', {
type: 'string',
choices: CI_PROVIDERS,
describe: 'CI/CD integration (github, gitlab, or none)',
})
.check(parsed => {
validatePluginSlugs(bindings, parsed.plugins);
return true;
})
.help()
.version();
}