mirror of
https://github.com/shadoll/just-commons.git
synced 2025-12-20 03:26:43 +00:00
Refactor: Add [no-cd] annotations to MySQL and container management scripts for improved clarity and consistency
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Universal container management operations
|
||||
|
||||
# Start service (or all services if no service specified)
|
||||
[no-cd]
|
||||
start service="" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -26,6 +27,7 @@ start service="" compose-file="":
|
||||
fi
|
||||
|
||||
# Stop service (or all services if no service specified)
|
||||
[no-cd]
|
||||
stop service="" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -51,6 +53,7 @@ stop service="" compose-file="":
|
||||
fi
|
||||
|
||||
# Restart service (or all services if no service specified)
|
||||
[no-cd]
|
||||
restart service="" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -75,6 +78,7 @@ restart service="" compose-file="":
|
||||
fi
|
||||
|
||||
# Show service status (specific service or all)
|
||||
[no-cd]
|
||||
status service="" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -98,6 +102,7 @@ status service="" compose-file="":
|
||||
fi
|
||||
|
||||
# View logs for specific service or all services
|
||||
[no-cd]
|
||||
logs service="" compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -121,6 +126,7 @@ logs service="" compose-file="":
|
||||
fi
|
||||
|
||||
# Open shell in specific container
|
||||
[no-cd]
|
||||
shell service compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -139,6 +145,7 @@ shell service compose-file="":
|
||||
$compose_cmd $file_arg exec "$service" /bin/bash
|
||||
|
||||
# Execute command in specific service container
|
||||
[no-cd]
|
||||
exec service cmd compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
@@ -155,4 +162,24 @@ exec service cmd compose-file="":
|
||||
fi
|
||||
|
||||
echo -e "{{BLUE}}Executing in $service: $cmd{{NORMAL}}"
|
||||
$compose_cmd $file_arg exec "$service" bash -c "$cmd"
|
||||
$compose_cmd $file_arg exec "$service" bash -c "$cmd"
|
||||
|
||||
# Execute command in specific service container with piped input support
|
||||
[no-cd]
|
||||
exec-pipe service cmd compose-file="":
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
compose_cmd=$(just _detect_compose)
|
||||
service="{{service}}"
|
||||
cmd="{{cmd}}"
|
||||
compose_file="{{compose-file}}"
|
||||
|
||||
# Build compose file argument
|
||||
file_arg=""
|
||||
if [ -n "$compose_file" ]; then
|
||||
file_arg="-f $compose_file"
|
||||
fi
|
||||
|
||||
echo -e "{{BLUE}}Executing in $service (with piped input): $cmd{{NORMAL}}"
|
||||
$compose_cmd $file_arg exec -T "$service" bash -c "$cmd"
|
||||
Reference in New Issue
Block a user