Ejemplo n.º 1
0
func printGlobalOptions(c *cli.Context) {
	fmt.Println("\nThe input flag args is:")

	for i, k := range c.GlobalFlagNames() {
		fmt.Printf("%d %s:%v\n", i, k, c.GlobalString(k))
	}
}
Ejemplo n.º 2
0
func handler(z actions.Zodiaction, c *cli.Context) {
	flags := map[string]string{}

	//TODO: is this a codegangsta bug, GlobalFlagNames?
	for _, flagName := range c.GlobalFlagNames() {
		flags[flagName] = c.String(flagName)
	}

	eOpts := endpoint.EndpointOptions{
		Host:      c.GlobalString("endpoint"),
		TLS:       c.GlobalBool("tls"),
		TLSVerify: c.GlobalBool("tlsverify"),
		TLSCaCert: c.GlobalString("tlscacert"),
		TLSCert:   c.GlobalString("tlscert"),
		TLSKey:    c.GlobalString("tlskey"),
	}

	actionOpts := actions.Options{
		Args:            c.Args(),
		Flags:           flags,
		EndpointOptions: eOpts,
	}

	o, err := z(actionOpts)
	if err != nil {
		fmt.Printf("Error: %s\n", err)
		os.Exit(1)
	}

	fmt.Println(o.ToPrettyOutput())
}