mirror of
https://github.com/acedanger/shell.git
synced 2026-03-24 20:11:49 -07:00
feat: Update README and add requirements.txt for rich library installation instructions
This commit is contained in:
@@ -18,10 +18,11 @@ A Python command-line application to manage Docker containers defined in subdire
|
|||||||
|
|
||||||
- Python 3
|
- Python 3
|
||||||
- Docker and Docker Compose (plugin) installed.
|
- Docker and Docker Compose (plugin) installed.
|
||||||
- The `rich` Python library:
|
- Python dependencies:
|
||||||
```bash
|
```bash
|
||||||
pip install rich
|
pip install -r ~/shell/docker-manager/requirements.txt
|
||||||
```
|
```
|
||||||
|
*Or manually:* `pip install rich`
|
||||||
- A `~/docker/` directory containing subdirectories for each of your projects.
|
- A `~/docker/` directory containing subdirectories for each of your projects.
|
||||||
- Each project subdirectory must contain a `docker-compose.yml`, `docker-compose.yaml`, `compose.yml`, or `compose.yaml` file.
|
- Each project subdirectory must contain a `docker-compose.yml`, `docker-compose.yaml`, `compose.yml`, or `compose.yaml` file.
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,17 @@ import argparse
|
|||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from rich.console import Console
|
|
||||||
from rich.table import Table
|
try:
|
||||||
from rich.panel import Panel
|
from rich.console import Console
|
||||||
from rich.text import Text
|
from rich.table import Table
|
||||||
from rich import box
|
from rich.panel import Panel
|
||||||
|
from rich import box
|
||||||
|
except ImportError:
|
||||||
|
print("Error: The 'rich' library is required but not installed.")
|
||||||
|
print("Please install it using: pip install -r ~/shell/docker-manager/requirements.txt")
|
||||||
|
print("Or directly: pip install rich")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
DOCKER_ROOT = Path(os.path.expanduser("~/docker"))
|
DOCKER_ROOT = Path(os.path.expanduser("~/docker"))
|
||||||
@@ -261,14 +267,14 @@ def list_containers(projects):
|
|||||||
update_status = "[dim]Not Monitored[/dim]"
|
update_status = "[dim]Not Monitored[/dim]"
|
||||||
|
|
||||||
# If version is still unknown, try to get from running container labels
|
# If version is still unknown, try to get from running container labels
|
||||||
if version == "latest" or version == "unknown":
|
if version in ("latest", "unknown"):
|
||||||
inspect_cmd = ["docker", "inspect", c_name, "--format", "{{json .Config.Labels}}"]
|
inspect_cmd = ["docker", "inspect", c_name, "--format", "{{json .Config.Labels}}"]
|
||||||
inspect_res = run_command(inspect_cmd, path, capture_output=True)
|
inspect_res = run_command(inspect_cmd, path, capture_output=True)
|
||||||
if inspect_res and inspect_res.returncode == 0:
|
if inspect_res and inspect_res.returncode == 0:
|
||||||
try:
|
try:
|
||||||
labels = json.loads(inspect_res.stdout)
|
labels = json.loads(inspect_res.stdout)
|
||||||
version = get_image_version(labels)
|
version = get_image_version(labels)
|
||||||
except:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
table.add_row(name, c_name, state, image, version, update_status)
|
table.add_row(name, c_name, state, image, version, update_status)
|
||||||
|
|||||||
1
docker-manager/requirements.txt
Normal file
1
docker-manager/requirements.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
rich>=13.0.0
|
||||||
Reference in New Issue
Block a user