|
32 | 32 | ) |
33 | 33 | from .process import stream_command |
34 | 34 |
|
| 35 | +HINT = "\nAre you trying to run a scenario? See `warnet run --help`" |
| 36 | + |
35 | 37 |
|
36 | 38 | def validate_directory(ctx, param, value): |
37 | 39 | directory = Path(value) |
38 | 40 | if not directory.is_dir(): |
39 | | - raise click.BadParameter(f"'{value}' is not a valid directory.") |
| 41 | + raise click.BadParameter(f"'{value}' is not a valid directory.{HINT}") |
40 | 42 | if not (directory / NETWORK_FILE).exists() and not (directory / NAMESPACES_FILE).exists(): |
41 | 43 | raise click.BadParameter( |
42 | | - f"'{value}' does not contain a valid network.yaml or namespaces.yaml file." |
| 44 | + f"'{value}' does not contain a valid network.yaml or namespaces.yaml file.{HINT}" |
43 | 45 | ) |
44 | 46 | return directory |
45 | 47 |
|
46 | 48 |
|
47 | | -@click.command() |
| 49 | +@click.command(context_settings={"ignore_unknown_options": True}) |
48 | 50 | @click.argument( |
49 | 51 | "directory", |
50 | | - type=click.Path(exists=True, file_okay=False, dir_okay=True), |
| 52 | + type=click.Path(exists=True), |
51 | 53 | callback=validate_directory, |
52 | 54 | ) |
53 | 55 | @click.option("--debug", is_flag=True) |
54 | 56 | @click.option("--namespace", type=str, help="Specify a namespace in which to deploy the network") |
55 | 57 | @click.option("--to-all-users", is_flag=True, help="Deploy network to all user namespaces") |
56 | | -def deploy(directory, debug, namespace, to_all_users): |
| 58 | +@click.argument("unknown_args", nargs=-1) |
| 59 | +def deploy(directory, debug, namespace, to_all_users, unknown_args): |
57 | 60 | """Deploy a warnet with topology loaded from <directory>""" |
| 61 | + if unknown_args: |
| 62 | + raise click.BadParameter(f"Unknown args: {unknown_args}{HINT}") |
| 63 | + |
58 | 64 | if to_all_users: |
59 | 65 | namespaces = get_namespaces_by_type(WARGAMES_NAMESPACE_PREFIX) |
60 | 66 | for namespace in namespaces: |
|
0 commit comments