@@ -5,6 +5,7 @@ use clap::{Parser, Subcommand, ValueEnum};
55use clap_complete:: Shell ;
66use dsc_lib:: dscresources:: command_resource:: TraceLevel ;
77use dsc_lib:: progress:: ProgressFormat ;
8+ use dsc_lib:: types:: { FullyQualifiedTypeName , ResourceVersionReq , TypeNameFilter } ;
89use rust_i18n:: t;
910use serde:: Deserialize ;
1011
@@ -178,7 +179,8 @@ pub enum ExtensionSubCommand {
178179 #[ clap( name = "list" , about = t!( "args.listExtensionAbout" ) . to_string( ) ) ]
179180 List {
180181 /// Optional extension name to filter the list
181- extension_name : Option < String > ,
182+ #[ clap( default_value_t) ]
183+ extension_name : TypeNameFilter ,
182184 #[ clap( short = 'o' , long, help = t!( "args.outputFormat" ) . to_string( ) ) ]
183185 output_format : Option < ListOutputFormat > ,
184186 } ,
@@ -200,10 +202,11 @@ pub enum ResourceSubCommand {
200202 #[ clap( name = "list" , about = t!( "args.listAbout" ) . to_string( ) ) ]
201203 List {
202204 /// Optional resource name to filter the list
203- resource_name : Option < String > ,
205+ #[ clap( default_value_t) ]
206+ resource_name : TypeNameFilter ,
204207 /// Optional adapter filter to apply to the list of resources
205208 #[ clap( short = 'a' , long = "adapter" , help = t!( "args.adapter" ) . to_string( ) ) ]
206- adapter_name : Option < String > ,
209+ adapter_name : Option < TypeNameFilter > ,
207210 #[ clap( short, long, help = t!( "args.description" ) . to_string( ) ) ]
208211 description : Option < String > ,
209212 #[ clap( short, long, help = t!( "args.tags" ) . to_string( ) ) ]
@@ -216,9 +219,9 @@ pub enum ResourceSubCommand {
216219 #[ clap( short, long, help = t!( "args.getAll" ) . to_string( ) ) ]
217220 all : bool ,
218221 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
219- resource : String ,
222+ resource : FullyQualifiedTypeName ,
220223 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
221- version : Option < String > ,
224+ version : Option < ResourceVersionReq > ,
222225 #[ clap( short, long, help = t!( "args.input" ) . to_string( ) , conflicts_with = "file" ) ]
223226 input : Option < String > ,
224227 #[ clap( short = 'f' , long, help = t!( "args.file" ) . to_string( ) , conflicts_with = "input" ) ]
@@ -229,9 +232,9 @@ pub enum ResourceSubCommand {
229232 #[ clap( name = "set" , about = "Invoke the set operation to a resource" , arg_required_else_help = true ) ]
230233 Set {
231234 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
232- resource : String ,
235+ resource : FullyQualifiedTypeName ,
233236 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
234- version : Option < String > ,
237+ version : Option < ResourceVersionReq > ,
235238 #[ clap( short, long, help = t!( "args.input" ) . to_string( ) , conflicts_with = "file" ) ]
236239 input : Option < String > ,
237240 #[ clap( short = 'f' , long, help = t!( "args.file" ) . to_string( ) , conflicts_with = "input" ) ]
@@ -244,9 +247,9 @@ pub enum ResourceSubCommand {
244247 #[ clap( name = "test" , about = "Invoke the test operation to a resource" , arg_required_else_help = true ) ]
245248 Test {
246249 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
247- resource : String ,
250+ resource : FullyQualifiedTypeName ,
248251 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
249- version : Option < String > ,
252+ version : Option < ResourceVersionReq > ,
250253 #[ clap( short, long, help = t!( "args.input" ) . to_string( ) , conflicts_with = "file" ) ]
251254 input : Option < String > ,
252255 #[ clap( short = 'f' , long, help = t!( "args.file" ) . to_string( ) , conflicts_with = "input" ) ]
@@ -257,9 +260,9 @@ pub enum ResourceSubCommand {
257260 #[ clap( name = "delete" , about = "Invoke the delete operation to a resource" , arg_required_else_help = true ) ]
258261 Delete {
259262 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
260- resource : String ,
263+ resource : FullyQualifiedTypeName ,
261264 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
262- version : Option < String > ,
265+ version : Option < ResourceVersionReq > ,
263266 #[ clap( short, long, help = t!( "args.input" ) . to_string( ) , conflicts_with = "file" ) ]
264267 input : Option < String > ,
265268 #[ clap( short = 'f' , long, help = t!( "args.file" ) . to_string( ) , conflicts_with = "input" ) ]
@@ -272,18 +275,18 @@ pub enum ResourceSubCommand {
272275 #[ clap( name = "schema" , about = "Get the JSON schema for a resource" , arg_required_else_help = true ) ]
273276 Schema {
274277 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
275- resource : String ,
278+ resource : FullyQualifiedTypeName ,
276279 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
277- version : Option < String > ,
280+ version : Option < ResourceVersionReq > ,
278281 #[ clap( short = 'o' , long, help = t!( "args.outputFormat" ) . to_string( ) ) ]
279282 output_format : Option < OutputFormat > ,
280283 } ,
281284 #[ clap( name = "export" , about = "Retrieve all resource instances" , arg_required_else_help = true ) ]
282285 Export {
283286 #[ clap( short, long, help = t!( "args.resource" ) . to_string( ) ) ]
284- resource : String ,
287+ resource : FullyQualifiedTypeName ,
285288 #[ clap( short, long, help = t!( "args.version" ) . to_string( ) ) ]
286- version : Option < String > ,
289+ version : Option < ResourceVersionReq > ,
287290 #[ clap( short, long, help = t!( "args.input" ) . to_string( ) , conflicts_with = "file" ) ]
288291 input : Option < String > ,
289292 #[ clap( short = 'f' , long, help = t!( "args.file" ) . to_string( ) , conflicts_with = "input" ) ]
0 commit comments