devnomads-cli 0.11.0__tar.gz → 0.11.1__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.
Files changed (21) hide show
  1. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/PKG-INFO +1 -1
  2. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/PKG-INFO +1 -1
  3. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/dncli.py +18 -1
  4. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/pyproject.toml +1 -1
  5. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_cli.py +28 -0
  6. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/LICENSE +0 -0
  7. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/README.md +0 -0
  8. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/SOURCES.txt +0 -0
  9. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/dependency_links.txt +0 -0
  10. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/entry_points.txt +0 -0
  11. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/requires.txt +0 -0
  12. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/devnomads_cli.egg-info/top_level.txt +0 -0
  13. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/setup.cfg +0 -0
  14. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_cert.py +0 -0
  15. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_config.py +0 -0
  16. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_generate.py +0 -0
  17. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_generated_cli.py +0 -0
  18. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_helpers.py +0 -0
  19. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_hook.py +0 -0
  20. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_transfer.py +0 -0
  21. {devnomads_cli-0.11.0 → devnomads_cli-0.11.1}/tests/test_versions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devnomads-cli
3
- Version: 0.11.0
3
+ Version: 0.11.1
4
4
  Summary: Manage your DevNomads services from the command line
5
5
  Author-email: DevNomads <support@devnomads.nl>
6
6
  License: MIT
@@ -63,7 +63,7 @@ from rich.markup import escape
63
63
  from rich.table import Table
64
64
  from typer.core import TyperGroup
65
65
 
66
- __version__ = "0.11.0"
66
+ __version__ = "0.11.1"
67
67
 
68
68
  # Distribution names, for reporting versions via `dncli version`.
69
69
  CLI_PACKAGE = "devnomads-cli"
@@ -9184,7 +9184,24 @@ def notify_update() -> None:
9184
9184
  _write_update_state(state)
9185
9185
 
9186
9186
 
9187
+ # Hidden spelling of --yes, for when you really, really mean it. Click cannot
9188
+ # hide one name of an option, so the entry point rewrites it before parsing.
9189
+ OPTION_ALIASES = {"--yes-i-really-really-mean-it": "--yes"}
9190
+
9191
+
9192
+ def expand_aliases(args: list[str]) -> list[str]:
9193
+ """Replace hidden option aliases; arguments after `--` stay as they are."""
9194
+
9195
+ expanded: list[str] = []
9196
+ for index, arg in enumerate(args):
9197
+ if arg == "--":
9198
+ return expanded + args[index:]
9199
+ expanded.append(OPTION_ALIASES.get(arg, arg))
9200
+ return expanded
9201
+
9202
+
9187
9203
  def run() -> None:
9204
+ sys.argv[1:] = expand_aliases(sys.argv[1:])
9188
9205
  start_update_check()
9189
9206
  try:
9190
9207
  app()
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "devnomads-cli"
3
- version = "0.11.0"
3
+ version = "0.11.1"
4
4
  description = "Manage your DevNomads services from the command line"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -632,3 +632,31 @@ def test_configure_list_masks_secrets(write_profile):
632
632
  assert rows["default"]["api_key"] == "dn_a...mnop"
633
633
  assert "dn_abcdefghijklmnop" not in result.output
634
634
  assert rows["transip:personal"]["type"] == "transip"
635
+
636
+
637
+ def test_yes_i_really_really_mean_it_is_a_hidden_yes():
638
+ assert dncli.expand_aliases(
639
+ ["emails", "delete", "3", "--yes-i-really-really-mean-it"]
640
+ ) == ["emails", "delete", "3", "--yes"]
641
+ # values after -- are left alone
642
+ assert dncli.expand_aliases(["x", "--", "--yes-i-really-really-mean-it"]) == [
643
+ "x",
644
+ "--",
645
+ "--yes-i-really-really-mean-it",
646
+ ]
647
+ result = runner.invoke(app, ["emails", "delete", "--help"])
648
+ assert "really" not in result.output
649
+
650
+
651
+ @respx.mock
652
+ def test_run_accepts_the_alias(configured, monkeypatch):
653
+ route = respx.delete(f"{API}/services/emails/3").mock(return_value=Response(204))
654
+ monkeypatch.setattr(
655
+ dncli.sys,
656
+ "argv",
657
+ ["dncli", "emails", "delete", "3", "--yes-i-really-really-mean-it"],
658
+ )
659
+ with pytest.raises(SystemExit) as exit_info:
660
+ dncli.run()
661
+ assert exit_info.value.code == 0
662
+ assert route.called
File without changes
File without changes
File without changes