Skip to content

Commit 18c313b

Browse files
committed
fix: resolve docker-image flag issue
1. Remove duplicate dockerImage variable in exec.go 2. Use global dockerImage variable from root.go 3. Fix docker command test cases
1 parent 16b7087 commit 18c313b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmd/runshell/cmd/exec.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ var execCmd = &cobra.Command{
2323
2424
Example:
2525
runshell exec ls -l
26-
runshell exec --env KEY=VALUE --workdir /tmp ls -l`,
26+
runshell exec --env KEY=VALUE --workdir /tmp ls -l
27+
runshell exec --docker-image ubuntu:latest ls -l`,
2728
Args: cobra.MinimumNArgs(1),
2829
RunE: runExec,
2930
}
@@ -33,6 +34,7 @@ func init() {
3334

3435
execCmd.Flags().StringVar(&workDir, "workdir", "", "Working directory for command execution")
3536
execCmd.Flags().StringArrayVar(&envVars, "env", nil, "Environment variables (KEY=VALUE)")
37+
execCmd.Flags().StringVar(&dockerImage, "docker-image", "", "Docker image to run command in")
3638

3739
// 禁用标志解析,这样可以正确处理命令参数中的标志
3840
execCmd.Flags().SetInterspersed(false)

0 commit comments

Comments
 (0)