Azure / autorest.az

Azure CLI Code Generator
MIT License
22 stars 20 forks source link

Cannot config `completer` property of argument. #789

Open kairu-ms opened 3 years ago

kairu-ms commented 3 years ago

Why do you need this feature?

We need to customize completer of argument.

Is your feature request related to a problem? Please describe.

Current

c.argument('circuit_name', type=str, help='The name of the circuit.')

Prefer

c.argument('circuit_name', type=str, help='The name of the circuit.', completer=get_resource_name_completion_list('Microsoft.Network/expressRouteCircuits'))

Describe the solution you'd like

Describe alternatives you've considered

Additional context

qiaozha commented 3 years ago

Plan to support in the following way: cli: cli-directive:

kairu-ms commented 3 years ago

Plan to support in the following way: cli: cli-directive:

  • where: group: groupName feature: completer: completer_name validator: validator_name

How can you find completer function only by it's name? Do you need import path?

qiaozha commented 3 years ago

Plan to support in the following way: cli: cli-directive:

  • where: group: groupName feature: completer: completer_name validator: validator_name

How can you find completer function only by it's name? Do you need import path?

directive:
   - where:
        group: group subgroup1
     feature:
        completer: completer_name
        validator: validator_name
     imports:
         azure.cli.core.completer:
             - completer_name
         azure.cli.core.validator:
             - validator_name

or

directive:
   - where:
        command: group subgroup1 command
     feature:
        completer: completer_name
        validator: validator_name
     imports:
         azure.cli.core.completer:
             - completer_name
         azure.cli.core.validator:
             - validator_name

how about something like this?