rrun-cli 0.2.1__tar.gz → 0.2.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rrun-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Run local scripts on remote machines over SSH via stdin pipes — no escaping/encoding hell. Supports python/powershell/bash, with a unified remote Python 3.12 venv provisioner.
5
5
  Author: waqiju
6
6
  License-Expression: MIT
@@ -106,7 +106,7 @@ The full set of hard-won conventions and internals: [docs/remote-exec-convention
106
106
  | `rrun doctor <host\|--all>` | Health-check ssh + auth + remote python (`--all` opens real connections to every machine) |
107
107
  | `rrun close [<host>\|--all]` | Close ssh ControlMaster multiplexed connections |
108
108
 
109
- Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`, `--env K=V`, `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
109
+ Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`/`--env K=V` (not for Windows+python), `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
110
110
 
111
111
  ### Exit codes
112
112
 
@@ -78,7 +78,7 @@ The full set of hard-won conventions and internals: [docs/remote-exec-convention
78
78
  | `rrun doctor <host\|--all>` | Health-check ssh + auth + remote python (`--all` opens real connections to every machine) |
79
79
  | `rrun close [<host>\|--all]` | Close ssh ControlMaster multiplexed connections |
80
80
 
81
- Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`, `--env K=V`, `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
81
+ Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`/`--env K=V` (not for Windows+python), `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
82
82
 
83
83
  ### Exit codes
84
84
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rrun-cli"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Run local scripts on remote machines over SSH via stdin pipes — no escaping/encoding hell. Supports python/powershell/bash, with a unified remote Python 3.12 venv provisioner."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -11,7 +11,7 @@ try:
11
11
 
12
12
  __version__ = _pkg_version("rrun-cli")
13
13
  except Exception: # noqa: BLE001 - 未安装(源码直跑)时回退
14
- __version__ = "0.2.1"
14
+ __version__ = "0.2.2"
15
15
 
16
16
  from .doctor import DoctorResult, check_machine
17
17
  from .executor import (
@@ -41,6 +41,7 @@ import sys
41
41
  import time
42
42
  from pathlib import Path
43
43
 
44
+ from . import __version__
44
45
  from .doctor import check_machine
45
46
  from .executor import RRUN_HOME, _check_ascii, _ssh_run, close_mux, run
46
47
  from .registry import load_machines, resolve_machine, scan_sources
@@ -277,6 +278,7 @@ def main() -> None:
277
278
  ap = argparse.ArgumentParser(
278
279
  prog="rrun",
279
280
  description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
281
+ ap.add_argument("--version", action="version", version=f"%(prog)s {__version__}")
280
282
  sub = ap.add_subparsers(dest="subcmd", required=True)
281
283
 
282
284
  ep = sub.add_parser("exec", help="execute a local script / inline content on a remote machine")
@@ -287,9 +289,9 @@ def main() -> None:
287
289
  ep.add_argument("-c", "--content", help="inline script content (archived to ~/.rrun/drops/)")
288
290
  ep.add_argument("args", nargs="*",
289
291
  help="script arguments (ASCII only; use -- to separate from options)")
290
- ep.add_argument("--workdir", help="remote working directory (bash/powershell only)")
292
+ ep.add_argument("--workdir", help="remote working directory (not for Windows+python)")
291
293
  ep.add_argument("--env", action="append", metavar="KEY=VAL",
292
- help="remote environment variable (repeatable; ASCII only)")
294
+ help="remote environment variable (repeatable; ASCII only; not for Windows+python)")
293
295
  ep.add_argument("--timeout", type=float, help="local timeout in seconds (exit=124 on expiry)")
294
296
  ep.add_argument("--python", dest="python", help="remote python path (skips auto-detection)")
295
297
  ep.add_argument("--no-utf8", action="store_true", help="do not pass -X utf8 to remote python")
@@ -352,7 +352,7 @@ def run(host: str, lang: str = "", file: str = "", content: str = "", args=(),
352
352
  py_cmd += " " + " ".join(shlex.quote(a) for a in args)
353
353
  if env or workdir:
354
354
  if machine.is_windows:
355
- raise ValueError("workdir/env are not supported for Windows+python yet; use os.chdir/os.environ inside the script")
355
+ raise ValueError("workdir/env are not supported for Windows+python (by design); use os.chdir/os.environ inside the script")
356
356
  remote_cmd = _posix_prefix(workdir, env) + py_cmd
357
357
  else:
358
358
  remote_cmd = py_cmd
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rrun-cli
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Run local scripts on remote machines over SSH via stdin pipes — no escaping/encoding hell. Supports python/powershell/bash, with a unified remote Python 3.12 venv provisioner.
5
5
  Author: waqiju
6
6
  License-Expression: MIT
@@ -106,7 +106,7 @@ The full set of hard-won conventions and internals: [docs/remote-exec-convention
106
106
  | `rrun doctor <host\|--all>` | Health-check ssh + auth + remote python (`--all` opens real connections to every machine) |
107
107
  | `rrun close [<host>\|--all]` | Close ssh ControlMaster multiplexed connections |
108
108
 
109
- Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`, `--env K=V`, `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
109
+ Useful `exec` flags: `--lang bash|powershell|python`, `--workdir`/`--env K=V` (not for Windows+python), `--timeout`, `--python <path>` (skip detection), `--no-mux`, `-q`.
110
110
 
111
111
  ### Exit codes
112
112
 
@@ -1,7 +1,10 @@
1
- """CLI 辅助函数测试:--env 解析、inline 落盘。"""
1
+ """CLI 辅助函数测试:--env 解析、inline 落盘、--version。"""
2
+
3
+ import sys
2
4
 
3
5
  import pytest
4
6
 
7
+ import rrun
5
8
  import rrun.__main__ as cli
6
9
 
7
10
 
@@ -27,3 +30,13 @@ class TestDropInline:
27
30
  def test_unknown_lang_txt(self, tmp_path, monkeypatch):
28
31
  monkeypatch.setattr(cli, "INLINE_DROP_DIR", tmp_path / "drops")
29
32
  assert cli._drop_inline("h", "weird", "x").suffix == ".txt"
33
+
34
+
35
+ class TestVersion:
36
+ def test_version_flag(self, monkeypatch, capsys):
37
+ # argparse version action 打印到 stdout 并以 0 退出
38
+ monkeypatch.setattr(sys, "argv", ["rrun", "--version"])
39
+ with pytest.raises(SystemExit) as e:
40
+ cli.main()
41
+ assert e.value.code == 0
42
+ assert capsys.readouterr().out.strip() == f"rrun {rrun.__version__}"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes