@@ -86,30 +86,78 @@ class App
8686
8787 desc 'Run on a device or simulator'
8888 command :run do |c |
89- c . flag [ :p , :platform ] ,
90- :desc => 'Specify platform, android or ios' ,
91- :must_match => [ "android" , "ios" , "web" ]
89+ c . command :android do |sc |
90+ sc . flag [ :f , :flavor ] ,
91+ :desc => 'Specify flavor'
92+
93+ sc . switch [ :r , :release ] ,
94+ :desc => 'Run in release mode, debug by default'
95+
96+ sc . switch [ :profile ] ,
97+ :desc => 'Run in profile mode, debug by default'
98+
99+ sc . switch [ 'dry-run' ] ,
100+ :desc => 'Prepare only for running the app (writing config files)'
101+
102+ sc . flag [ :d , :device ] ,
103+ :desc => 'Specify a device ID to target'
92104
93- c . flag [ :f , :flavor ] ,
94- :desc => 'Specify flavor'
105+ sc . action do |global_options , options , args |
106+ mergedOptions = global_options . merge ( **options , **options [ GLI ::Command ::PARENT ] , **{ 'platform' : 'android' } )
107+ mergedOptions . delete ( GLI ::Command ::PARENT )
108+ Commands ::Run . new ( mergedOptions ) . execute
109+ end
110+ end
111+
112+ c . command :ios do |sc |
113+ sc . flag [ :f , :flavor ] ,
114+ :desc => 'Specify flavor'
115+
116+ sc . switch [ :r , :release ] ,
117+ :desc => 'Run in release mode, debug by default'
95118
96- c . switch [ :r , :release ] ,
97- :desc => 'Run in release mode, debug by default'
98-
99- c . switch [ :profile ] ,
100- :desc => 'Run in profile mode, debug by default'
101-
102- c . switch [ :prepare ] ,
103- :desc => 'Prepare only for running the app (writing config files)'
104-
105- c . flag [ :d , :device ] ,
106- :desc => 'Specify a device ID to target'
119+ sc . switch [ :profile ] ,
120+ :desc => 'Run in profile mode, debug by default'
121+
122+ sc . switch [ 'dry-run' ] ,
123+ :desc => 'Prepare only for running the app (writing config files)'
107124
108- c . flag [ :port ] ,
109- :desc => 'Specify the port to use: https://localhost:<port> '
125+ sc . flag [ :d , :device ] ,
126+ :desc => 'Specify a device ID to target '
110127
111- c . action do |global_options , options , args |
112- Commands ::Run . new ( global_options . merge ( options ) ) . execute
128+ sc . action do |global_options , options , args |
129+ mergedOptions = global_options . merge ( **options , **options [ GLI ::Command ::PARENT ] , **{ 'platform' : 'ios' } )
130+ mergedOptions . delete ( GLI ::Command ::PARENT )
131+ Commands ::Run . new ( mergedOptions ) . execute
132+ end
133+ end
134+
135+ c . command :web do |sc |
136+ sc . flag [ :f , :flavor ] ,
137+ :desc => 'Specify flavor'
138+
139+ sc . switch [ :r , :release ] ,
140+ :desc => 'Run in release mode, debug by default'
141+
142+ sc . switch [ 'dry-run' ] ,
143+ :desc => 'Prepare only for running the app (writing config files)'
144+
145+ sc . flag [ :d , :device ] ,
146+ :desc => 'Specify a device ID to target'
147+
148+ sc . flag [ :port ] ,
149+ :desc => 'Specify the port to use: https://localhost:<port>'
150+
151+ sc . flag [ 'web-renderer' ] ,
152+ :desc => 'Specify the renderer' ,
153+ :must_match => [ 'canvaskit' , 'html' , 'auto' ] ,
154+ :default_value => 'auto'
155+
156+ sc . action do |global_options , options , args |
157+ mergedOptions = global_options . merge ( **options , **options [ GLI ::Command ::PARENT ] , **{ 'platform' : 'web' } )
158+ mergedOptions . delete ( GLI ::Command ::PARENT )
159+ Commands ::Run . new ( mergedOptions ) . execute
160+ end
113161 end
114162 end
115163
@@ -122,7 +170,7 @@ class App
122170 sc . flag [ :f , :flavor ] ,
123171 :desc => 'Specify flavor'
124172
125- sc . switch [ :prepare ] ,
173+ sc . switch [ 'dry-run' ] ,
126174 :desc => 'Prepare only for running the app (writing config files)' ,
127175 :negatable => false
128176
@@ -148,7 +196,7 @@ class App
148196 sc . flag [ :f , :flavor ] ,
149197 :desc => 'Specify flavor'
150198
151- sc . switch [ :prepare ] ,
199+ sc . switch [ 'dry-run' ] ,
152200 :desc => 'Prepare only for running the app (writing config files)' ,
153201 :negatable => false
154202
@@ -179,10 +227,15 @@ class App
179227 sc . flag [ :f , :flavor ] ,
180228 :desc => 'Specify flavor'
181229
182- sc . switch [ :prepare ] ,
230+ sc . switch [ 'dry-run' ] ,
183231 :desc => 'Prepare only for running the app (writing config files)' ,
184232 :negatable => false
185233
234+ sc . flag [ 'web-renderer' ] ,
235+ :desc => 'Specify the renderer' ,
236+ :must_match => [ 'canvaskit' , 'html' , 'auto' ] ,
237+ :default_value => 'auto'
238+
186239 sc . action do |global_options , options , args |
187240 mergedOptions = global_options . merge ( **options , **options [ GLI ::Command ::PARENT ] , **{ 'platform' : 'web' } )
188241 mergedOptions . delete ( GLI ::Command ::PARENT )
0 commit comments