Skip to content

Commit fc7b914

Browse files
committed
Allow specifying additional parameters passed to app
This can be done with "exec" parameter. It can be used more than one time, for instance: goaci --exec=--param1=value1 --exec=--param2 \ --exec 'value2 with spaces' github.com/coreos/etcd
1 parent d277c9b commit fc7b914

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

goaci.go

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"archive/tar"
55
"bytes"
66
"compress/gzip"
7+
"flag"
78
"fmt"
89
"io/ioutil"
910
"os"
@@ -31,7 +32,21 @@ func debug(i ...interface{}) {
3132
}
3233
}
3334

35+
type StringVector []string
36+
37+
func (v *StringVector) String() string {
38+
return "\"" + strings.Join(*v, "\" \"") + "\""
39+
}
40+
41+
func (v *StringVector) Set(str string) error {
42+
*v = append(*v, str)
43+
return nil
44+
}
45+
3446
func main() {
47+
var execOpts StringVector
48+
flag.Var(&execOpts, "exec", "Parameters passed to app, can be used multiple times")
49+
flag.Parse()
3550
if os.Getenv("GOPATH") != "" {
3651
die("to avoid confusion GOPATH must not be set")
3752
}
@@ -145,15 +160,15 @@ func main() {
145160
}
146161
debug("moved binary to:", ep)
147162

163+
exec := []string{filepath.Join("/", fn)}
164+
exec = append(exec, execOpts...)
148165
// Build the ACI
149166
im := schema.ImageManifest{
150167
ACKind: types.ACKind("ImageManifest"),
151168
ACVersion: schema.AppContainerVersion,
152169
Name: *name,
153170
App: &types.App{
154-
Exec: types.Exec{
155-
filepath.Join("/", fn),
156-
},
171+
Exec: exec,
157172
User: "0",
158173
Group: "0",
159174
},

0 commit comments

Comments
 (0)