fast-dev-cli 0.19.2__tar.gz → 0.19.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.
Files changed (34) hide show
  1. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/PKG-INFO +1 -1
  2. fast_dev_cli-0.19.3/fast_dev_cli/__init__.py +1 -0
  3. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/fast_dev_cli/cli.py +17 -6
  4. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/pyproject.toml +1 -1
  5. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_exec.py +10 -0
  6. fast_dev_cli-0.19.2/fast_dev_cli/__init__.py +0 -1
  7. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/LICENSE +0 -0
  8. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/README.md +0 -0
  9. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/fast_dev_cli/__main__.py +0 -0
  10. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/fast_dev_cli/py.typed +0 -0
  11. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/pdm_build.py +0 -0
  12. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/scripts/check.py +0 -0
  13. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/scripts/deps.py +0 -0
  14. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/scripts/format.py +0 -0
  15. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/scripts/test.py +0 -0
  16. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/__init__.py +0 -0
  17. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/assets/uv-tx.lock +0 -0
  18. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/assets/uv.lock +0 -0
  19. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/conftest.py +0 -0
  20. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_bump.py +0 -0
  21. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_deps.py +0 -0
  22. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_fast_test.py +0 -0
  23. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_functions.py +0 -0
  24. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_help.py +0 -0
  25. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_lint.py +0 -0
  26. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_poetry_version_plugin.py +0 -0
  27. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_pypi.py +0 -0
  28. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_runserver.py +0 -0
  29. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_sync.py +0 -0
  30. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_tag.py +0 -0
  31. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_upgrade.py +0 -0
  32. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_upload.py +0 -0
  33. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/test_version.py +0 -0
  34. {fast_dev_cli-0.19.2 → fast_dev_cli-0.19.3}/tests/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fast-dev-cli
3
- Version: 0.19.2
3
+ Version: 0.19.3
4
4
  Summary: Python project development tool.
5
5
  Author-Email: Waket Zheng <waketzheng@gmail.com>>
6
6
  Classifier: Development Status :: 4 - Beta
@@ -0,0 +1 @@
1
+ __version__ = "0.19.3"
@@ -139,14 +139,25 @@ class Shell:
139
139
  @property
140
140
  def command(self) -> list[str] | str:
141
141
  command: list[str] | str = self._cmd
142
- if (
143
- isinstance(command, str)
144
- and "shell" not in self._kw
145
- and not (set(self._cmd) & {"|", ">", "&"})
146
- ):
147
- command = shlex.split(command)
142
+ if isinstance(command, str):
143
+ cs = shlex.split(command)
144
+ if "shell" not in self._kw and not (set(self._cmd) & {"|", ">", "&"}):
145
+ command = self.extend_user(cs)
146
+ elif any(i.startswith("~") for i in cs):
147
+ command = re.sub(r" ~", " " + os.path.expanduser("~"), command)
148
+ else:
149
+ command = self.extend_user(command)
148
150
  return command
149
151
 
152
+ @staticmethod
153
+ def extend_user(cs: list[str]) -> list[str]:
154
+ if cs[0] == "echo":
155
+ return cs
156
+ for i, c in enumerate(cs):
157
+ if c.startswith("~"):
158
+ cs[i] = os.path.expanduser(c)
159
+ return cs
160
+
150
161
  def _run(self) -> subprocess.CompletedProcess[str]:
151
162
  return self.run_by_subprocess(self.command, **self._kw)
152
163
 
@@ -41,7 +41,7 @@ dependencies = [
41
41
  "bumpversion2 >=1.4.3",
42
42
  "pytest >=8.2.0",
43
43
  ]
44
- version = "0.19.2"
44
+ version = "0.19.3"
45
45
 
46
46
  [project.urls]
47
47
  Homepage = "https://github.com/waketzheng/fast-dev-cli"
@@ -1,3 +1,5 @@
1
+ import os
2
+
1
3
  import pytest
2
4
 
3
5
  from fast_dev_cli.cli import Exit, capture_cmd_output, run_by_subprocess
@@ -15,6 +17,8 @@ def test_exec_dry():
15
17
  )
16
18
  assert "success" in out
17
19
  assert "failed" not in out
20
+ out = capture_cmd_output('fast exec "python ~/0.py" --dry')
21
+ assert "--> python ~/0.py" in out
18
22
 
19
23
 
20
24
  def test_exec():
@@ -29,6 +33,12 @@ def test_exec():
29
33
  )
30
34
  assert "failed" in out
31
35
  assert "success" not in out
36
+ out = capture_cmd_output('fast exec "ls -a ~/"')
37
+ assert "--> ls -a ~" in out
38
+ assert ".bashrc" in out
39
+ home = os.path.expanduser("~")
40
+ expected = capture_cmd_output(f"ls {home}")
41
+ assert not (set(expected.splitlines()) - set(out.splitlines()))
32
42
 
33
43
 
34
44
  def test_run_by_subprocess(capsys):
@@ -1 +0,0 @@
1
- __version__ = "0.19.2"
File without changes
File without changes