Skip to content

Commit c8d6b3d

Browse files
[Feature]: Allow listing available key resources such as gpu, region, and backends #2142
Show an error if unknown arg is passed to `dstack gpu`
1 parent f9744d4 commit c8d6b3d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

  • src/dstack/_internal/cli/commands

src/dstack/_internal/cli/commands/gpu.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ def _register(self):
5959

6060
def _command(self, args: argparse.Namespace):
6161
super()._command(args)
62+
63+
# Validate that no unknown arguments were passed
64+
if hasattr(args, "unknown") and args.unknown:
65+
from dstack._internal.core.errors import CLIError
66+
67+
unknown_args_str = " ".join(args.unknown)
68+
raise CLIError(f"Unrecognized arguments: {unknown_args_str}")
69+
6270
conf = TaskConfiguration(commands=[":"])
6371

6472
configurator = GpuConfigurator(api_client=self.api)

0 commit comments

Comments
 (0)