compshare-cli 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/PKG-INFO +1 -1
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/pyproject.toml +1 -1
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/__init__.py +1 -1
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/cli.py +10 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/PKG-INFO +1 -1
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_cli.py +8 -2
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/README.md +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/setup.cfg +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/__main__.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/actions.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/api.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/commands/__init__.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/commands/common.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/commands/image.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/commands/instance.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/commands/storage.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/config.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/errors.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/i18n.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/location.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/output.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/parsing.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/runtime.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli/sdk.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/SOURCES.txt +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/dependency_links.txt +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/entry_points.txt +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/requires.txt +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/src/compshare_cli.egg-info/top_level.txt +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_actions.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_config.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_location.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_output.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_parsing.py +0 -0
- {compshare_cli-0.1.2 → compshare_cli-0.1.3}/tests/test_sdk.py +0 -0
|
@@ -21,9 +21,19 @@ _TYPER_CLICK_EXCEPTIONS = getattr(_TYPER_CLICK, "exceptions", _TYPER_CLICK)
|
|
|
21
21
|
_CLICK_EXCEPTIONS = (click.ClickException, _TYPER_CLICK_EXCEPTIONS.ClickException)
|
|
22
22
|
_ABORT_EXCEPTIONS = (click.Abort, _TYPER_CLICK_EXCEPTIONS.Abort)
|
|
23
23
|
|
|
24
|
+
|
|
25
|
+
class RootGroup(typer_core.TyperGroup):
|
|
26
|
+
def list_commands(self, ctx):
|
|
27
|
+
names = super().list_commands(ctx)
|
|
28
|
+
if "config" not in names:
|
|
29
|
+
return names
|
|
30
|
+
return ["config", *(name for name in names if name != "config")]
|
|
31
|
+
|
|
32
|
+
|
|
24
33
|
app = typer.Typer(
|
|
25
34
|
name="compshare",
|
|
26
35
|
help="Manage CompShare GPU compute from the terminal.",
|
|
36
|
+
cls=RootGroup,
|
|
27
37
|
no_args_is_help=True,
|
|
28
38
|
add_completion=False,
|
|
29
39
|
context_settings={"help_option_names": ["-h", "--help"]},
|
|
@@ -29,12 +29,12 @@ def test_help_tree(args) -> None:
|
|
|
29
29
|
|
|
30
30
|
def test_global_json_is_accepted_before_command(capsys) -> None:
|
|
31
31
|
cli.main(["--json", "version"])
|
|
32
|
-
assert json.loads(capsys.readouterr().out) == {"version": "0.1.
|
|
32
|
+
assert json.loads(capsys.readouterr().out) == {"version": "0.1.3"}
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def test_global_profile_is_accepted_before_command(capsys) -> None:
|
|
36
36
|
cli.main(["--profile", "testing", "--json", "version"])
|
|
37
|
-
assert json.loads(capsys.readouterr().out) == {"version": "0.1.
|
|
37
|
+
assert json.loads(capsys.readouterr().out) == {"version": "0.1.3"}
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
def test_no_args_shows_help_without_error(capsys) -> None:
|
|
@@ -44,6 +44,12 @@ def test_no_args_shows_help_without_error(capsys) -> None:
|
|
|
44
44
|
assert "Traceback" not in captured.err
|
|
45
45
|
|
|
46
46
|
|
|
47
|
+
def test_root_help_lists_config_first(capsys) -> None:
|
|
48
|
+
cli.main(["-h"])
|
|
49
|
+
help_text = capsys.readouterr().out
|
|
50
|
+
assert help_text.index("config") < help_text.index("version")
|
|
51
|
+
|
|
52
|
+
|
|
47
53
|
def test_global_options_after_command_are_rejected(capsys) -> None:
|
|
48
54
|
with pytest.raises(SystemExit) as raised:
|
|
49
55
|
cli.main(["version", "--json"])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|