-
Notifications
You must be signed in to change notification settings - Fork 5
/
usage_exec.go
42 lines (33 loc) · 876 Bytes
/
usage_exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main
import (
"flag"
"os"
)
const (
DescriptionExecCommand = "Execute a command in a running container"
)
type ExecCommand struct {
fs *flag.FlagSet
detach bool
tty bool
user string
}
func NewExecCommand() *ExecCommand {
gc := &ExecCommand{
fs: flag.NewFlagSet("exec", flag.ExitOnError),
}
gc.fs.BoolVar(&gc.detach, "d", false, "Detached mode: Run command in the background.")
gc.fs.BoolVar(&gc.tty, "T", false, "Disable pseudo-TTY allocation. By default "+binaryName+" exec allocates a TTY.")
gc.fs.StringVar(&gc.user, "u", "", "Run the command as this user.")
gc.fs.Usage = displayUsage(gc.fs, os.Stdout, DescriptionExecCommand, "exec")
return gc
}
func (g *ExecCommand) Name() string {
return g.fs.Name()
}
func (g *ExecCommand) Init(args []string) error {
return g.fs.Parse(args)
}
func (g *ExecCommand) Run() error {
return nil
}