Skip to content

Commit baf225e

Browse files
authored
Merge pull request #514 from necusjz/refine-cli-generate
chore: hidden useless parameters
2 parents 3fa9d73 + bbfd59a commit baf225e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/aaz_dev/cli/api/_cmds.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -203,13 +203,18 @@ def generate_by_swagger_tag(profile, swagger_tag, extension_or_module_name, cli_
203203
@click.option(
204204
"--cli-path", '-c',
205205
type=click.Path(file_okay=False, dir_okay=True, writable=True, readable=True, resolve_path=True),
206+
default=Config.CLI_PATH,
206207
callback=Config.validate_and_setup_cli_path,
208+
expose_value=False,
207209
help="The local path of azure-cli repo. Only required when generate code to azure-cli repo."
208210
)
209211
@click.option(
210212
"--cli-extension-path", '-e',
211213
type=click.Path(file_okay=False, dir_okay=True, writable=True, readable=True, resolve_path=True),
214+
default=Config.CLI_EXTENSION_PATH,
212215
callback=Config.validate_and_setup_cli_extension_path,
216+
expose_value=False,
217+
hidden=True,
213218
help="The local path of azure-cli-extension repo. Only required when generate code to azure-cli-extension repo."
214219
)
215220
@click.option(
@@ -218,15 +223,16 @@ def generate_by_swagger_tag(profile, swagger_tag, extension_or_module_name, cli_
218223
default=Config.SWAGGER_PATH,
219224
callback=Config.validate_and_setup_swagger_path,
220225
expose_value=False,
226+
hidden=True,
221227
help="The local path of azure-rest-api-specs repo. Official repo is https://github.com/Azure/azure-rest-api-specs"
222228
)
223229
@click.option(
224230
"--aaz-path", '-a',
225231
type=click.Path(file_okay=False, dir_okay=True, writable=True, readable=True, resolve_path=True),
226232
default=Config.AAZ_PATH,
227-
required=not Config.AAZ_PATH,
228233
callback=Config.validate_and_setup_aaz_path,
229234
expose_value=False,
235+
hidden=True,
230236
help="The local path of aaz repo."
231237
)
232238
@click.option(
@@ -239,7 +245,7 @@ def generate_by_swagger_tag(profile, swagger_tag, extension_or_module_name, cli_
239245
required=True,
240246
help="Module name of the CLI extension target."
241247
)
242-
def generate(spec, module, cli_path=None, cli_extension_path=None):
248+
def generate(spec, module, cli_path=None):
243249
def _collect_resources(spec):
244250
module_manager = SwaggerSpecsManager().get_module_manager(Config.DEFAULT_PLANE, spec)
245251
rps = module_manager.get_resource_providers()
@@ -363,19 +369,15 @@ def to_cli():
363369
logger.info(f"Regenerate module `{module}`.")
364370
manager.update_module(module, ext.profiles)
365371

366-
if cli_path and cli_extension_path:
367-
logger.error("Please provide either `--cli-path` or `--cli-extension-path`.")
368-
raise sys.exit(1)
369-
370372
spec_path = os.path.join(Config.SWAGGER_PATH, "specification", spec)
371373
if not os.path.exists(spec_path) or not os.path.isdir(spec_path):
372374
raise ValueError(f"Cannot find the specification name under {Config.SWAGGER_PATH}.")
373375

374376
try:
375377
to_aaz()
376-
logger.info(" Finished generating AAZ model.")
378+
logger.info(" Finished generating AAZ model.")
377379
to_cli()
378-
logger.info(" Finished generating AAZ codes.")
380+
logger.info(" Finished generating AAZ codes.")
379381

380382
except (InvalidAPIUsage, ValueError) as err:
381383
logger.error(err, exc_info=True)

0 commit comments

Comments
 (0)