Skip to content

Commit 6edc986

Browse files
committed
Restore the j command
1 parent 3e9c55e commit 6edc986

File tree

5 files changed

+25
-31
lines changed

5 files changed

+25
-31
lines changed

jumpstarter/cli/control.py

Lines changed: 0 additions & 28 deletions
This file was deleted.

jumpstarter/cli/j.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import os
2+
3+
from anyio.from_thread import start_blocking_portal
4+
5+
from jumpstarter.client import client_from_channel
6+
from jumpstarter.common.grpc import insecure_channel
7+
8+
9+
def main():
10+
host = os.environ.get("JUMPSTARTER_HOST", None)
11+
12+
if host is None:
13+
raise RuntimeError("j command can only be used under jmp shell")
14+
15+
with start_blocking_portal() as portal:
16+
channel = portal.call(insecure_channel, host)
17+
client = portal.call(client_from_channel, channel, portal)
18+
client.cli()()
19+
20+
21+
if __name__ == "__main__":
22+
main()

jumpstarter/cli/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import click
44

55
from .client import client
6-
from .control import control_from_env
76
from .exporter import exporter
87
from .shell import shell
98
from .version import version
@@ -17,6 +16,7 @@ def help():
1716
click.echo(ctx.parent.get_help())
1817
ctx.exit()
1918

19+
2020
@click.group(no_args_is_help=True)
2121
def main():
2222
pass
@@ -26,4 +26,3 @@ def main():
2626
main.add_command(shell)
2727
main.add_command(exporter)
2828
main.add_command(client)
29-
main.add_command(control_from_env(), "control")

jumpstarter/cli/util/alias.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AliasedGroup(click.Group):
1010
"create": ["cr"],
1111
"move": ["mv"],
1212
"config": ["conf"],
13-
"delete": ["del"]
13+
"delete": ["del"],
1414
}
1515

1616
def get_command(self, ctx: click.Context, cmd_name: str):

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ subdirectory = "python"
3333

3434
[tool.poetry.scripts]
3535
jmp = "jumpstarter.__main__:main"
36+
j = "jumpstarter.cli.j:main"
3637

3738
[tool.poetry.group.dev.dependencies]
3839
pytest = "^8.2.2"

0 commit comments

Comments
 (0)