@@ -25,6 +25,14 @@ export interface CreateProgramOptions {
2525 devMode ?: boolean ;
2626}
2727
28+ function addDefaultOptions ( program : Command ) : void {
29+ program . option ( "-q, --quietmode" , "Reduce output to a minimum" , false ) ;
30+ program . option ( "-p, --profile [profile]" ) ;
31+ program . option ( "--gitProfile [gitProfile]" , "Git profile to use" ) ;
32+ program . option ( "--debug" , "Print debug messages" , false ) ;
33+ program . option ( "--dev" , "Development Mode" , false ) ;
34+ }
35+
2836/**
2937 * Build a fully-configured Commander program without parsing argv
3038 */
@@ -36,11 +44,7 @@ export function createProgram(context: Context, opts: CreateProgramOptions = {})
3644 optionTerm : opt => new ContentCLIHelp ( ) . optionTerm ( opt ) ,
3745 } ) ;
3846 program . version ( VersionUtils . getCurrentCliVersion ( ) ) ;
39- program . option ( "-q, --quietmode" , "Reduce output to a minimum" , false ) ;
40- program . option ( "-p, --profile [profile]" ) ;
41- program . option ( "--gitProfile [gitProfile]" , "Git profile to use" ) ;
42- program . option ( "--debug" , "Print debug messages" , false ) ;
43- program . option ( "--dev" , "Development Mode" , false ) ;
47+ addDefaultOptions ( program ) ;
4448
4549 const moduleHandler = new ModuleHandler ( program , context ) ;
4650 configureRootCommands ( moduleHandler . configurator ) ;
@@ -78,11 +82,7 @@ async function run(): Promise<void> {
7882 // Parse global options up-front so banner/debug-level decisions can use
7983 // them before module discovery runs.
8084 const bootstrapProgram = new Command ( ) ;
81- bootstrapProgram . option ( "-q, --quietmode" , "Reduce output to a minimum" , false ) ;
82- bootstrapProgram . option ( "-p, --profile [profile]" ) ;
83- bootstrapProgram . option ( "--gitProfile [gitProfile]" , "Git profile to use" ) ;
84- bootstrapProgram . option ( "--debug" , "Print debug messages" , false ) ;
85- bootstrapProgram . option ( "--dev" , "Development Mode" , false ) ;
85+ addDefaultOptions ( bootstrapProgram ) ;
8686 bootstrapProgram . allowUnknownOption ( true ) ;
8787 bootstrapProgram . parseOptions ( process . argv ) ;
8888 const globalOpts = bootstrapProgram . opts ( ) ;
0 commit comments