11import 'package:args/args.dart' ;
2- import 'package:flutter_bunny/src/common/config_manager.dart' ;
2+
3+ import 'config_manager.dart' ;
34
45/// Default description for new Flutter projects.
56const _defaultDescription =
@@ -26,28 +27,40 @@ mixin ArgParserConfiguration {
2627 }) {
2728 // If we have a config manager, use it to get default values
2829 final config = configManager;
29-
30+
3031 // Get defaults from config or use provided defaults
3132 final defaultArchitecture = config? .getValue <String >(
32- 'defaults.architecture' ,
33- defaultValue: architecture ?? 'clean_architecture' ,
34- ) ?? architecture ?? 'clean_architecture' ;
35-
33+ 'defaults.architecture' ,
34+ defaultValue: architecture ?? 'clean_architecture' ,
35+ ) ??
36+ architecture ??
37+ 'clean_architecture' ;
38+
3639 final defaultStateManagement = config? .getValue <String >(
37- 'defaults.state_management' ,
38- defaultValue: stateManagement ?? 'provider' ,
39- ) ?? stateManagement ?? 'provider' ;
40-
41- final defaultFeatures = config? .getValue <List <dynamic >>(
42- 'defaults.features' ,
43- defaultValue: features? .cast <dynamic >() ?? ['authentication' ],
44- )? .cast <String >() ?? features ?? ['authentication' ];
45-
46- final defaultModules = config? .getValue <List <dynamic >>(
47- 'defaults.modules' ,
48- defaultValue: modules? .cast <dynamic >() ?? ['network_layer' ],
49- )? .cast <String >() ?? modules ?? ['network_layer' ];
50-
40+ 'defaults.state_management' ,
41+ defaultValue: stateManagement ?? 'provider' ,
42+ ) ??
43+ stateManagement ??
44+ 'provider' ;
45+
46+ final defaultFeatures = config
47+ ? .getValue <List <dynamic >>(
48+ 'defaults.features' ,
49+ defaultValue: features? .cast <dynamic >() ?? ['authentication' ],
50+ )
51+ ? .cast <String >() ??
52+ features ??
53+ ['authentication' ];
54+
55+ final defaultModules = config
56+ ? .getValue <List <dynamic >>(
57+ 'defaults.modules' ,
58+ defaultValue: modules? .cast <dynamic >() ?? ['network_layer' ],
59+ )
60+ ? .cast <String >() ??
61+ modules ??
62+ ['network_layer' ];
63+
5164 // Configure the argument parser with the resolved default values
5265 argParser
5366 // Project configuration options
@@ -67,7 +80,7 @@ mixin ArgParserConfiguration {
6780 help: 'The name of the Flutter project (in snake_case).' ,
6881 defaultsTo: projectName ?? 'my_flutter_app' ,
6982 )
70-
83+
7184 // Architecture and structure options
7285 ..addOption (
7386 'architecture' ,
@@ -93,7 +106,7 @@ mixin ArgParserConfiguration {
93106 ],
94107 defaultsTo: defaultStateManagement,
95108 )
96-
109+
97110 // Feature and module options
98111 ..addMultiOption (
99112 'features' ,
@@ -102,7 +115,7 @@ mixin ArgParserConfiguration {
102115 'authentication' ,
103116 'user_profile' ,
104117 'settings' ,
105- 'dashboard'
118+ 'dashboard' ,
106119 ],
107120 defaultsTo: defaultFeatures,
108121 )
@@ -117,22 +130,22 @@ mixin ArgParserConfiguration {
117130 ],
118131 defaultsTo: defaultModules,
119132 )
120-
133+
121134 // Mode options
122135 ..addFlag (
123136 'interactive' ,
124137 abbr: 'i' ,
125138 help: 'Run in interactive mode to configure the project.' ,
126- negatable: true ,
127139 defaultsTo: config? .getValue <bool >(
128- 'generation.interactive' ,
129- defaultValue: true ,
130- ) ?? true ,
140+ 'generation.interactive' ,
141+ defaultValue: true ,
142+ ) ??
143+ true ,
131144 )
132145 ..addFlag (
133146 'verbose' ,
134147 help: 'Show verbose output for debugging.' ,
135148 negatable: false ,
136149 );
137150 }
138- }
151+ }
0 commit comments