@@ -5,85 +5,92 @@ import { Command } from 'commander';
55 * @returns The configured commander program instance
66 */
77export function createProgram ( ) {
8- return new Command ( )
9- . name ( 'dotenv-diff' )
10- . description ( 'Compare .env and .env.example files' )
11- . option ( '--check-values' , 'Compare actual values if example has values' )
12- . option ( '--ci' , 'Run non-interactively and never create files' )
13- . option ( '-y, --yes' , 'Run non-interactively and answer Yes to prompts' )
14- . option ( '--env <file>' , 'Path to a specific .env file' )
15- . option ( '--example <file>' , 'Path to a specific .env.example file' )
16- . option (
17- '--allow-duplicates' ,
18- 'Do not warn about duplicate keys in .env* files' ,
19- )
20- . option ( '--ignore <keys>' , 'Comma-separated list of keys to ignore' )
21- . option ( '--ignore-regex <pattern>' , 'Regex pattern to ignore matching keys' )
22- . option (
23- '--fix' ,
24- 'Automatically fix common issues: remove duplicates, add missing keys' ,
25- )
26- . option ( '--json' , 'Output results in JSON format' )
27- . option ( '--color' , 'Enable colored output' )
28- . option ( '--no-color' , 'Disable colored output' )
29- . option (
30- '--only <list>' ,
31- 'Comma-separated categories to only run (missing,extra,empty,duplicate,gitignore)' ,
32- )
33- . option ( '--scan-usage' , 'Scan codebase for environment variable usage' )
34- . option ( '--compare' , 'Compare .env and .env.example files' )
35- . option (
36- '--include-files <patterns>' ,
37- 'Comma-separated file patterns to ADD to default scan patterns (extends default)' ,
38- )
39- . option (
40- '--files <patterns>' ,
41- 'Comma-separated file patterns to scan (completely replaces default patterns)' ,
42- )
43- . option (
44- '--exclude-files <patterns>' ,
45- 'Comma-separated file patterns to exclude from scan' ,
46- )
47- . option (
48- '--show-unused' ,
49- 'List variables that are defined in .env but not used in code' ,
50- )
51- . option (
52- '--no-show-unused' ,
53- 'Do not list variables that are defined in .env but not used in code' ,
54- )
55- . option ( '--show-stats' , 'Show statistics' )
56- . option ( '--no-show-stats' , 'Do not show statistics' )
57- . option ( '--strict' , 'Enable fail on warnings' )
58- . option (
59- '--secrets' ,
60- 'Enable secret detection during scan (enabled by default)' ,
61- )
62- . option (
63- '--no-secrets' ,
64- 'Disable secret detection during scan (enabled by default)' ,
65- )
66- . option (
67- '--ignore-urls <list>' ,
68- 'Comma-separated URLs to ignore in secret scan' ,
69- )
70- . option (
71- '--uppercase-keys' ,
72- 'Enable uppercase key validation (enabled by default)' ,
73- )
74- . option ( '--no-uppercase-keys' , 'Disable uppercase key validation' )
75- . option (
76- '--expire-warnings' ,
77- 'Enable expiration date warnings for environment variables (enabled by default)' ,
78- )
79- . option ( '--no-expire-warnings' , 'Disable expiration date warnings' )
80- . option (
81- '--inconsistent-naming-warnings' ,
82- 'Enable inconsistent naming pattern warnings (enabled by default)' ,
83- )
84- . option (
85- '--no-inconsistent-naming-warnings' ,
86- 'Disable inconsistent naming pattern warnings' ,
87- )
88- . option ( '--init' , 'Create a sample dotenv-diff.config.json file' ) ;
8+ return (
9+ new Command ( )
10+ . name ( 'dotenv-diff' )
11+ . description ( 'Compare .env and .env.example files' )
12+ // Ignore extra positional args
13+ . allowExcessArguments ( true )
14+ . option ( '--check-values' , 'Compare actual values if example has values' )
15+ . option ( '--ci' , 'Run non-interactively and never create files' )
16+ . option ( '-y, --yes' , 'Run non-interactively and answer Yes to prompts' )
17+ . option ( '--env <file>' , 'Path to a specific .env file' )
18+ . option ( '--example <file>' , 'Path to a specific .env.example file' )
19+ . option (
20+ '--allow-duplicates' ,
21+ 'Do not warn about duplicate keys in .env* files' ,
22+ )
23+ . option ( '--ignore <keys>' , 'Comma-separated list of keys to ignore' )
24+ . option (
25+ '--ignore-regex <pattern>' ,
26+ 'Regex pattern to ignore matching keys' ,
27+ )
28+ . option (
29+ '--fix' ,
30+ 'Automatically fix common issues: remove duplicates, add missing keys' ,
31+ )
32+ . option ( '--json' , 'Output results in JSON format' )
33+ . option ( '--color' , 'Enable colored output' )
34+ . option ( '--no-color' , 'Disable colored output' )
35+ . option (
36+ '--only <list>' ,
37+ 'Comma-separated categories to only run (missing,extra,empty,duplicate,gitignore)' ,
38+ )
39+ . option ( '--scan-usage' , 'Scan codebase for environment variable usage' )
40+ . option ( '--compare' , 'Compare .env and .env.example files' )
41+ . option (
42+ '--include-files <patterns>' ,
43+ 'Comma-separated file patterns to ADD to default scan patterns (extends default)' ,
44+ )
45+ . option (
46+ '--files <patterns>' ,
47+ 'Comma-separated file patterns to scan (completely replaces default patterns)' ,
48+ )
49+ . option (
50+ '--exclude-files <patterns>' ,
51+ 'Comma-separated file patterns to exclude from scan' ,
52+ )
53+ . option (
54+ '--show-unused' ,
55+ 'List variables that are defined in .env but not used in code' ,
56+ )
57+ . option (
58+ '--no-show-unused' ,
59+ 'Do not list variables that are defined in .env but not used in code' ,
60+ )
61+ . option ( '--show-stats' , 'Show statistics' )
62+ . option ( '--no-show-stats' , 'Do not show statistics' )
63+ . option ( '--strict' , 'Enable fail on warnings' )
64+ . option (
65+ '--secrets' ,
66+ 'Enable secret detection during scan (enabled by default)' ,
67+ )
68+ . option (
69+ '--no-secrets' ,
70+ 'Disable secret detection during scan (enabled by default)' ,
71+ )
72+ . option (
73+ '--ignore-urls <list>' ,
74+ 'Comma-separated URLs to ignore in secret scan' ,
75+ )
76+ . option (
77+ '--uppercase-keys' ,
78+ 'Enable uppercase key validation (enabled by default)' ,
79+ )
80+ . option ( '--no-uppercase-keys' , 'Disable uppercase key validation' )
81+ . option (
82+ '--expire-warnings' ,
83+ 'Enable expiration date warnings for environment variables (enabled by default)' ,
84+ )
85+ . option ( '--no-expire-warnings' , 'Disable expiration date warnings' )
86+ . option (
87+ '--inconsistent-naming-warnings' ,
88+ 'Enable inconsistent naming pattern warnings (enabled by default)' ,
89+ )
90+ . option (
91+ '--no-inconsistent-naming-warnings' ,
92+ 'Disable inconsistent naming pattern warnings' ,
93+ )
94+ . option ( '--init' , 'Create a sample dotenv-diff.config.json file' )
95+ ) ;
8996}
0 commit comments