Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,17 @@ To run the tests:
```bash
python -m pytest
```
### Troubleshooting

#### Error: File "setup.py" not found.
If you get this error when running:

> ERROR: File "setup.py" not found. Directory cannot be installed in editable mode: ...
(A "pyproject.toml" file was found, but editable mode currently requires a setup.py based build.)

it usually means you need to upgrade pip to version 21.3 or newer
```
pip install --upgrade pip
```


40 changes: 39 additions & 1 deletion arm_cli/container/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

@click.group()
def container():
"""Manage Docker containers"""
"""Basic tools for managing Docker containers. For more extensive tooling, try lazydocker"""
pass


Expand Down Expand Up @@ -60,6 +60,44 @@ def attach_container():
print("\nExiting interactive session...")


@container.command("restart")
def restart_container():
"""Interactively select a running Docker container and restart it"""
containers = get_running_containers()

if not containers:
print("No running containers found.")
return

container_choices = [
inquirer.List(
"container",
message="Select a container to restart",
choices=[f"{container.name} ({container.id[:12]})" for container in containers],
carousel=True,
)
]

answers = inquirer.prompt(container_choices)
if not answers:
print("No container selected.")
return

selected_container_name = answers["container"].split(" ")[0]

print(f"Restarting {selected_container_name}...")

try:
client = docker.from_env()
container = client.containers.get(selected_container_name)
container.restart()
print(f"Container {selected_container_name} restarted successfully.")
except docker.errors.NotFound:
print(f"Error: Container {selected_container_name} not found.")
except docker.errors.APIError as e:
print(f"Error restarting container: {e}")


@container.command("stop")
def stop_container():
"""Interactively select a running Docker container and stop it"""
Expand Down
5 changes: 4 additions & 1 deletion arm_cli/system/shell_scripts/shell_addins.fish
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

# Setup autocomplete
_ARM_CLI_COMPLETE=fish_source arm-cli | source
_ARM_CLI_COMPLETE=fish_source arm-cli | source

# Export for use when launching Docker to match host file ownership
set -x CURRENT_UID (id -u):(id -g)
9 changes: 6 additions & 3 deletions arm_cli/system/shell_scripts/shell_addins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## Setup autocomplete
# TODO: We can speed this up by generating the script offline. See https://click.palletsprojects.com/en/stable/shell-completion/
if type arm-cli >/dev/null 2>&1; then
eval "$(_ARM_CLI_COMPLETE=source arm-cli)" # TODO: This needs to change to eval "$(_ARM_CLI_COMPLETE=source arm-cli)" at some version.
eval "$(_ARM_CLI_COMPLETE=bash_source arm-cli)"
fi


Expand All @@ -11,8 +11,11 @@ alias_name="aa"
cli_path=$(which arm-cli)

# Create the alias if the cli was found
# TODO: Unfortunately, tab complete doesn't work when using the alias. Need to investigate a workaround
if [ -n "$cli_path" ]; then
alias $alias_name='$cli_path'
alias $alias_name="$cli_path"
fi

# TODO: Figure out tab complete for the alias

# Export for use when launching Docker to match host file ownership
export CURRENT_UID=$(id -u):$(id -g)
5 changes: 4 additions & 1 deletion arm_cli/system/shell_scripts/shell_addins.zsh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

# Setup autocomplete
eval "$(_ARM_CLI_COMPLETE=zsh_source arm-cli)""
eval "$(_ARM_CLI_COMPLETE=zsh_source arm-cli)"

# Export for use when launching Docker to match host file ownership
export CURRENT_UID=$(id -u):$(id -g)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "arm-cli"
version = "0.1"
version = "0.1.1"
description = "Experimental CLI for deploying robotic applications"
readme = "README.md"
authors = [{name = "Matthew Powelson"}]
Expand All @@ -18,7 +18,7 @@ dependencies = [
]

[build-system]
requires = ["setuptools"]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"

[tool.setuptools.package-data]
Expand Down
Loading