Merge pull request #168 from kadel/global-dab

Make --dab/--bundle global flag
This commit is contained in:
Tomas Kral 2016-09-26 11:19:43 +02:00 committed by GitHub
commit c593ff8e44
4 changed files with 11 additions and 24 deletions

View File

@ -11,7 +11,7 @@
For example, if you have a Docker bundle like [`docker-compose-bundle.dsb`](./examples/docker-compose-bundle.dsb), you can convert it into Kubernetes deployments and services like this: For example, if you have a Docker bundle like [`docker-compose-bundle.dsb`](./examples/docker-compose-bundle.dsb), you can convert it into Kubernetes deployments and services like this:
```console ```console
$ kompose convert --bundle docker-compose-bundle.dsb $ kompose --bundle docker-compose-bundle.dsb convert
WARN[0000]: Unsupported key networks - ignoring WARN[0000]: Unsupported key networks - ignoring
file "redis-svc.json" created file "redis-svc.json" created
file "web-svc.json" created file "web-svc.json" created

View File

@ -108,7 +108,7 @@ func validateFlags(opt kobject.ConvertOptions, singleOutput bool, dabFile, input
// Convert transforms docker compose or dab file to k8s objects // Convert transforms docker compose or dab file to k8s objects
func Convert(c *cli.Context) { func Convert(c *cli.Context) {
inputFile := c.GlobalString("file") inputFile := c.GlobalString("file")
dabFile := c.String("bundle") dabFile := c.GlobalString("bundle")
outFile := c.String("out") outFile := c.String("out")
generateYaml := c.BoolT("yaml") generateYaml := c.BoolT("yaml")
toStdout := c.BoolT("stdout") toStdout := c.BoolT("stdout")
@ -194,7 +194,7 @@ func Up(c *cli.Context) {
client := client.NewOrDie(clientConfig) client := client.NewOrDie(clientConfig)
inputFile := c.GlobalString("file") inputFile := c.GlobalString("file")
dabFile := c.String("bundle") dabFile := c.GlobalString("bundle")
komposeObject := kobject.KomposeObject{ komposeObject := kobject.KomposeObject{
ServiceConfigs: make(map[string]kobject.ServiceConfig), ServiceConfigs: make(map[string]kobject.ServiceConfig),
@ -244,7 +244,7 @@ func Down(c *cli.Context) {
client := client.NewOrDie(clientConfig) client := client.NewOrDie(clientConfig)
inputFile := c.GlobalString("file") inputFile := c.GlobalString("file")
dabFile := c.String("bundle") dabFile := c.GlobalString("bundle")
komposeObject := kobject.KomposeObject{ komposeObject := kobject.KomposeObject{
ServiceConfigs: make(map[string]kobject.ServiceConfig), ServiceConfigs: make(map[string]kobject.ServiceConfig),

View File

@ -32,11 +32,6 @@ func ConvertCommand() cli.Command {
app.Convert(c) app.Convert(c)
}, },
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{
Name: "bundle,dab",
Usage: "Specify a Distributed Application Bundle (DAB) file",
EnvVar: "DAB_FILE",
},
cli.StringFlag{ cli.StringFlag{
Name: "out,o", Name: "out,o",
Usage: "Specify file name in order to save objects into", Usage: "Specify file name in order to save objects into",
@ -87,13 +82,6 @@ func UpCommand() cli.Command {
Action: func(c *cli.Context) { Action: func(c *cli.Context) {
app.Up(c) app.Up(c)
}, },
Flags: []cli.Flag{
cli.StringFlag{
Name: "bundle,dab",
Usage: "Specify a Distributed Application Bundle (DAB) file",
EnvVar: "DAB_FILE",
},
},
} }
} }
@ -105,19 +93,18 @@ func DownCommand() cli.Command {
Action: func(c *cli.Context) { Action: func(c *cli.Context) {
app.Down(c) app.Down(c)
}, },
Flags: []cli.Flag{
cli.StringFlag{
Name: "bundle,dab",
Usage: "Specify a Distributed Application Bundle (DAB) file",
EnvVar: "DAB_FILE",
},
},
} }
} }
// CommonFlags defines the flags that are in common for all subcommands. // CommonFlags defines the flags that are in common for all subcommands.
func CommonFlags() []cli.Flag { func CommonFlags() []cli.Flag {
return []cli.Flag{ return []cli.Flag{
cli.StringFlag{
Name: "bundle,dab",
Usage: "Specify a Distributed Application Bundle (DAB) file",
EnvVar: "DAB_FILE",
},
cli.StringFlag{ cli.StringFlag{
Name: "file,f", Name: "file,f",
Usage: fmt.Sprintf("Specify an alternative compose file (default: %s)", app.DefaultComposeFile), Usage: fmt.Sprintf("Specify an alternative compose file (default: %s)", app.DefaultComposeFile),

View File

@ -55,7 +55,7 @@ db-svc.json docker-compose-bundle.dsb docker-voting.yml redis-svc.json
Using `--bundle, --dab` to specify a DAB file as below: Using `--bundle, --dab` to specify a DAB file as below:
```console ```console
$ kompose convert --bundle docker-compose-bundle.dsb $ kompose --bundle docker-compose-bundle.dsb convert
WARN[0000]: Unsupported key networks - ignoring WARN[0000]: Unsupported key networks - ignoring
file "redis-svc.json" created file "redis-svc.json" created
file "web-svc.json" created file "web-svc.json" created