comma-command 0.1.0__tar.gz → 0.1.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.
- {comma_command-0.1.0 → comma_command-0.1.1}/PKG-INFO +7 -1
- {comma_command-0.1.0 → comma_command-0.1.1}/README.md +6 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/pyproject.toml +1 -1
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/__init__.py +1 -1
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/cli.py +7 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/tests/test_cli.py +3 -1
- {comma_command-0.1.0 → comma_command-0.1.1}/tests/test_dispatch.py +16 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/.github/workflows/ci.yml +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/.gitignore +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/LICENSE +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/__main__.py +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/config.py +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/dispatch.py +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/src/comma_command/paths.py +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/tests/conftest.py +0 -0
- {comma_command-0.1.0 → comma_command-0.1.1}/tests/test_config.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: comma-command
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Run any configured command from any shell as `name, args` — register once, invoke everywhere.
|
|
5
5
|
Project-URL: Homepage, https://github.com/by3hak/comma-command
|
|
6
6
|
Project-URL: Repository, https://github.com/by3hak/comma-command
|
|
@@ -78,6 +78,11 @@ subcommands, applied to names:
|
|
|
78
78
|
the config.
|
|
79
79
|
3. It calls `os.execvpe("too", ["too", "talk", "gus", "--", "hello", "world"])`.
|
|
80
80
|
|
|
81
|
+
If the shim directory is not on `PATH` — a CI job, a container, a repo where nobody
|
|
82
|
+
ran `comma init` — `comma gus, hello world` reaches the same dispatch path. `comma`
|
|
83
|
+
takes `NAME,` rather than bare `NAME` so that a registered name can never collide
|
|
84
|
+
with the management subcommands (`ls`, `run`, `doctor`, ...).
|
|
85
|
+
|
|
81
86
|
Because the final step *replaces* the process instead of spawning a child, the
|
|
82
87
|
target command inherits the terminal, stdin, signals and job control directly, and
|
|
83
88
|
its exit status reaches your shell unchanged. `comma,` adds no wrapping layer.
|
|
@@ -116,6 +121,7 @@ keep flags from being swallowed by the target's own option parser.
|
|
|
116
121
|
| `comma rm NAME` | unregister a name and remove its shim |
|
|
117
122
|
| `comma ls [--json]` | list registered names |
|
|
118
123
|
| `comma run NAME [--] [ARG...]` | run a name without going through the shim |
|
|
124
|
+
| `comma NAME, [ARG...]` | the shell spelling, without the shim on PATH (handy in CI) |
|
|
119
125
|
| `comma which NAME` | show the shim path and the command it runs |
|
|
120
126
|
| `comma init [--write] [--shell S]` | print or install PATH + completion setup |
|
|
121
127
|
| `comma doctor` | check config, PATH, shims and targets |
|
|
@@ -47,6 +47,11 @@ subcommands, applied to names:
|
|
|
47
47
|
the config.
|
|
48
48
|
3. It calls `os.execvpe("too", ["too", "talk", "gus", "--", "hello", "world"])`.
|
|
49
49
|
|
|
50
|
+
If the shim directory is not on `PATH` — a CI job, a container, a repo where nobody
|
|
51
|
+
ran `comma init` — `comma gus, hello world` reaches the same dispatch path. `comma`
|
|
52
|
+
takes `NAME,` rather than bare `NAME` so that a registered name can never collide
|
|
53
|
+
with the management subcommands (`ls`, `run`, `doctor`, ...).
|
|
54
|
+
|
|
50
55
|
Because the final step *replaces* the process instead of spawning a child, the
|
|
51
56
|
target command inherits the terminal, stdin, signals and job control directly, and
|
|
52
57
|
its exit status reaches your shell unchanged. `comma,` adds no wrapping layer.
|
|
@@ -85,6 +90,7 @@ keep flags from being swallowed by the target's own option parser.
|
|
|
85
90
|
| `comma rm NAME` | unregister a name and remove its shim |
|
|
86
91
|
| `comma ls [--json]` | list registered names |
|
|
87
92
|
| `comma run NAME [--] [ARG...]` | run a name without going through the shim |
|
|
93
|
+
| `comma NAME, [ARG...]` | the shell spelling, without the shim on PATH (handy in CI) |
|
|
88
94
|
| `comma which NAME` | show the shim path and the command it runs |
|
|
89
95
|
| `comma init [--write] [--shell S]` | print or install PATH + completion setup |
|
|
90
96
|
| `comma doctor` | check config, PATH, shims and targets |
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "comma-command"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.1"
|
|
8
8
|
description = "Run any configured command from any shell as `name, args` — register once, invoke everywhere."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -25,6 +25,7 @@ usage:
|
|
|
25
25
|
comma rm NAME unregister NAME
|
|
26
26
|
comma ls [--json] list registered commands
|
|
27
27
|
comma run NAME [--] [ARG...] run NAME without going through the shim
|
|
28
|
+
comma NAME, [ARG...] same as `NAME,`, for shells without the shim on PATH
|
|
28
29
|
comma which NAME show the shim and what NAME runs
|
|
29
30
|
comma init [--write] [--shell S] print or install shell setup (PATH + completion)
|
|
30
31
|
comma doctor check the installation
|
|
@@ -428,6 +429,12 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
428
429
|
if name is not None:
|
|
429
430
|
return dispatch(name, args)
|
|
430
431
|
|
|
432
|
+
# `comma NAME, args...` — the same spelling as the shell form, for machines
|
|
433
|
+
# where the shim directory is not on PATH. Not `comma NAME args`: that would
|
|
434
|
+
# collide with the management subcommands (an alias called `ls` or `run`).
|
|
435
|
+
if args and len(args[0]) > 1 and args[0].endswith(","):
|
|
436
|
+
return dispatch(args[0][:-1], args[1:])
|
|
437
|
+
|
|
431
438
|
if not args or args[0] in ("-h", "--help", "help"):
|
|
432
439
|
sys.stdout.write(USAGE)
|
|
433
440
|
return 0
|
|
@@ -116,7 +116,9 @@ def test_completion_scripts(comma, env) -> None:
|
|
|
116
116
|
|
|
117
117
|
|
|
118
118
|
def test_version_and_help(comma, env) -> None:
|
|
119
|
-
|
|
119
|
+
from comma_command import __version__
|
|
120
|
+
|
|
121
|
+
assert f"comma {__version__}" in comma("--version").stdout
|
|
120
122
|
usage = comma("--help").stdout
|
|
121
123
|
assert "comma add NAME" in usage
|
|
122
124
|
assert comma("bogus").returncode == 2
|
|
@@ -88,3 +88,19 @@ def test_broken_config_is_reported(comma, env, launcher, echoargs) -> None:
|
|
|
88
88
|
|
|
89
89
|
assert result.returncode == 1
|
|
90
90
|
assert "invalid TOML" in result.stderr
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def test_name_comma_sugar_without_shim(comma, env, launcher, echoargs) -> None:
|
|
94
|
+
comma("add", "gus", "--", str(echoargs), "--")
|
|
95
|
+
|
|
96
|
+
result = comma("gus,", "hello", "world")
|
|
97
|
+
|
|
98
|
+
assert result.returncode == 0
|
|
99
|
+
assert result.stdout.splitlines() == ["--", "hello", "world"]
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_name_comma_sugar_unknown_name(comma, env, launcher) -> None:
|
|
103
|
+
result = comma("ghost,", "hi")
|
|
104
|
+
|
|
105
|
+
assert result.returncode == 127
|
|
106
|
+
assert "no command named 'ghost'" in result.stderr
|
|
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
|