Merge pull request #86 from AkihiroSuda/driver-ls

Put driver names to create --help
pull/93/head
Tõnis Tiigi 6 years ago committed by GitHub
commit afeaed790f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -154,6 +154,11 @@ func runCreate(dockerCli command.Cli, in createOptions, args []string) error {
func createCmd(dockerCli command.Cli) *cobra.Command { func createCmd(dockerCli command.Cli) *cobra.Command {
var options createOptions var options createOptions
var drivers []string
for s := range driver.GetFactories() {
drivers = append(drivers, s)
}
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "create [OPTIONS] [CONTEXT|ENDPOINT]", Use: "create [OPTIONS] [CONTEXT|ENDPOINT]",
Short: "Create a new builder instance", Short: "Create a new builder instance",
@ -166,7 +171,7 @@ func createCmd(dockerCli command.Cli) *cobra.Command {
flags := cmd.Flags() flags := cmd.Flags()
flags.StringVar(&options.name, "name", "", "Builder instance name") flags.StringVar(&options.name, "name", "", "Builder instance name")
flags.StringVar(&options.driver, "driver", "", "Driver to use (eg. docker-container)") flags.StringVar(&options.driver, "driver", "", fmt.Sprintf("Driver to use (available: %v)", drivers))
flags.StringVar(&options.nodeName, "node", "", "Create/modify node with given name") flags.StringVar(&options.nodeName, "node", "", "Create/modify node with given name")
flags.StringArrayVar(&options.platform, "platform", []string{}, "Fixed platforms for current node") flags.StringArrayVar(&options.platform, "platform", []string{}, "Fixed platforms for current node")

@ -85,3 +85,7 @@ func GetDriver(ctx context.Context, name string, f Factory, api dockerclient.API
} }
return f.New(ctx, ic) return f.New(ctx, ic)
} }
func GetFactories() map[string]Factory {
return drivers
}

Loading…
Cancel
Save