feat: Allow container matching by ID prefix (#175)

This commit is contained in:
Anton Ovchinnikov
2025-11-10 08:38:20 +10:00
committed by GitHub
parent 2f5f515696
commit 15d4ef5518
5 changed files with 26 additions and 16 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ func NewExecCommand() *cobra.Command {
Use: "exec [OPTIONS] SERVICE [COMMAND ARGS...]",
Short: "Execute a command in a running service container",
Long: `Execute a command (interactive shell by default) in a running container within a service.
If the service has multiple replicas, the command will be executed in a random container.
If the service has multiple replicas and no container ID is specified, the command will be executed in a random container.
`,
Example: `
# Start an interactive shell ("bash" or "sh" will be tried by default)
@@ -37,8 +37,8 @@ If the service has multiple replicas, the command will be executed in a random c
# Start an interactive shell with explicit command
uc exec web-service /bin/zsh
# List files in the specific container of the service
uc exec --container d792ea7347e5 web-service ls -la
# List files in the specific container of the service; --container accepts full ID or a (unique) prefix
uc exec --container d792e web-service ls -la
# Pipe input to a command inside the service container
cat backup.sql | uc exec -T db-service psql -U postgres mydb