@@ -238,7 +238,8 @@ def logout(cli):
238238
239239
240240@cli .argument ('query' , arg_only = True , action = StoreDictKeyPair , nargs = '?' , help = "id=UUIDv4 or query params as k=v,k=v comma-separated pairs" )
241- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" , choices = [choice for group in [[singular (type ), MUTABLE_NET_RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
241+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" ,
242+ choices = [choice for group in [[singular (type ), MUTABLE_NET_RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
242243# this allows us to pass the edit subcommand's cli object to function get without further modifying that functions params
243244@cli .subcommand ('duplicate a resource' )
244245def copy (cli ):
@@ -269,7 +270,8 @@ def copy(cli):
269270
270271
271272@cli .argument ('-f' , '--file' , help = 'JSON or YAML file' , type = argparse .FileType ('r' , encoding = 'UTF-8' ))
272- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" , choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
273+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" ,
274+ choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
273275@cli .subcommand ('create a resource from a file' )
274276def create (cli ):
275277 """Create a resource.
@@ -341,7 +343,8 @@ def create(cli):
341343
342344
343345@cli .argument ('query' , arg_only = True , action = StoreDictKeyPair , nargs = '?' , help = "id=UUIDv4 or query params as k=v,k=v comma-separated pairs" )
344- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" , choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
346+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" ,
347+ choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in MUTABLE_NET_RESOURCES .keys ()] for choice in group ])
345348# this allows us to pass the edit subcommand's cli object to function get without further modifying that functions params
346349@cli .subcommand ('edit a resource with EDITOR' )
347350def edit (cli ):
@@ -375,8 +378,11 @@ def edit(cli):
375378@cli .argument ('query' , arg_only = True , action = StoreDictKeyPair , nargs = '?' , help = "id=UUIDv4 or query params as k=v,k=v comma-separated pairs" )
376379@cli .argument ('-k' , '--keys' , arg_only = True , action = StoreListKeys , help = "list of keys as a,b,c to print only selected keys (columns)" )
377380@cli .argument ('-a' , '--as' , dest = 'accept' , arg_only = True , choices = ['create' ], help = "request the as=create alternative form of the resource" )
378- @cli .argument ('-e' , '--embed' , arg_only = True , action = StoreListKeys , default = None , help = "applies to 'get network': optionally embed comma-sep list of resource types or 'all' of a network's resource collections" , choices = [plural (type ) for type in EMBED_NET_RESOURCES .keys ()])
379- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" , choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
381+ @cli .argument ('-e' , '--embed' , arg_only = True , nargs = '+' ,
382+ help = "applies to 'get network': optionally embed space-sep list of resource types or 'all' of a network's resource collections" ,
383+ choices = [plural (type ) for type in EMBED_NET_RESOURCES .keys ()].extend ('all' ))
384+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" ,
385+ choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
380386@cli .subcommand ('get a single resource by type and query' )
381387def get (cli , echo : bool = True , spinner : object = None ):
382388 """
@@ -559,7 +565,8 @@ def get(cli, echo: bool = True, spinner: object = None):
559565@cli .argument ('-k' , '--keys' , arg_only = True , action = StoreListKeys , help = "list of keys as a,b,c to print only selected keys (columns)" )
560566@cli .argument ('-m' , '--my-roles' , arg_only = True , action = 'store_true' , help = "filter roles by caller identity" )
561567@cli .argument ('-a' , '--as' , dest = 'accept' , arg_only = True , choices = ['create' ], help = "request the as=create alternative form of the resources" )
562- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" , choices = [choice for group in [[type , RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
568+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , metavar = "RESOURCE_TYPE" ,
569+ choices = [choice for group in [[type , RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
563570@cli .subcommand (description = 'find a collection of resources by type and query' )
564571def list (cli , spinner : object = None ):
565572 """Find resources as lists."""
@@ -693,7 +700,8 @@ def list(cli, spinner: object = None):
693700
694701
695702@cli .argument ('query' , arg_only = True , action = StoreDictKeyPair , nargs = '?' , help = "query params as k=v,k=v comma-separated pairs" )
696- @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' , choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
703+ @cli .argument ('resource_type' , arg_only = True , help = 'type of resource' ,
704+ choices = [choice for group in [[singular (type ), RESOURCES [type ].abbreviation ] for type in RESOURCES .keys ()] for choice in group ])
697705@cli .subcommand ('delete a single resource by type and query' )
698706def delete (cli ):
699707 """Delete a resource in the network domain."""
0 commit comments