Skip to content

Commit

Permalink
Merge pull request #25 from CrowdJustice/creating-shell-command
Browse files Browse the repository at this point in the history
adding shell command
  • Loading branch information
phil-bell authored Mar 14, 2022
2 parents 7226598 + 4aecc50 commit f5d368e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
7 changes: 7 additions & 0 deletions legl_dev/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ def install(

steps.run()

@app.command(help="Remote into a container")
def shell(environment: Optional[str] = typer.Argument(default="backend", help="Container to remote into")):
steps = Steps()
steps.add(
Command(command=f"docker compose exec {environment} bash")
)
steps.run()

@app.callback()
def main(version: bool = False):
Expand Down
26 changes: 26 additions & 0 deletions legl_dev/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,29 @@ def test_install_self_upgrade(run):
),
]
run.assert_has_calls(calls)

@mock.patch("legl_dev.command.run")
def test_remote_frontend_commands(run):
main.shell("frontend")
calls = [
mock.call(
["docker", "compose", "exec", "frontend", "bash"],
universal_newlines=True,
shell=False,
check=True,
),
]
run.assert_has_calls(calls)

@mock.patch("legl_dev.command.run")
def test_remote_frontend_commands(run):
main.shell("frontend")
calls = [
mock.call(
["docker", "compose", "exec", "frontend", "bash"],
universal_newlines=True,
shell=False,
check=True,
),
]
run.assert_has_calls(calls)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from setuptools import setup

version = "1.1.2"
version = "1.2.0"

packages = ["legl_dev"]

Expand Down

0 comments on commit f5d368e

Please sign in to comment.