Esempio n. 1
0
func main() {
	var verbose bool
	ovrclk := &cobra.Command{Use: "ovrclk", Short: "Utility to manage your clusters and applications"}
	ovrclk.Flags().BoolVarP(&verbose, "verbose", "v", false, "verbose mode")

	var app string
	appInfo := &cobra.Command{Use: "info", Short: "display app info", Run: runFunc}
	appInfo.Flags().StringVarP(&app, "app", "a", "", "app name")
	apps := &cobra.Command{Use: "apps", Short: "manage apps", Long: "List all apps", Run: runFunc}
	apps.AddCommand(appInfo)
	ovrclk.AddCommand(apps)

	var cluster string
	clusterInfo := &cobra.Command{Use: "info", Short: "display cluster info", Run: runFunc}
	clusterInfo.Flags().StringVarP(&cluster, "clusters", "c", "", "cluster name")
	clusters := &cobra.Command{Use: "clusters", Short: "manage clusters", Long: "list all clusters", Run: runFunc}
	clusters.AddCommand(clusterInfo)
	ovrclk.AddCommand(clusters)

	auth := &cobra.Command{Use: "auth", Short: "manage auth", Long: "manage auth"}
	auth.AddCommand(&cobra.Command{Use: "token", Short: "display auth token", Run: runFunc})
	ovrclk.AddCommand(auth)

	version := &cobra.Command{Use: "version", Short: "display version", Run: runFunc}
	ovrclk.AddCommand(version)

	// Enable monocle
	monocle.Enable(ovrclk)

	// Set primary topics
	monocle.Primary(apps, clusters)
	cmdns.Namespace(ovrclk)

	ovrclk.Execute()
}
Esempio n. 2
0
File: main.go Progetto: gosuri/cmdns
func main() {
	hugo := &cobra.Command{
		Use:   "hugo",
		Short: "Hugo is a very fast static site generator",
		Long:  "A Fast and Flexible Static Site Generator built with love by spf13 and friends in Go",
	}

	newCmd := &cobra.Command{
		Use:   "new",
		Short: "Create new content for your site",
		Long:  "Create a new content file and automatically set the date and title. It will guess which kind of file to create based on the path provided.",
		Run:   runFunc,
	}
	hugo.AddCommand(newCmd)

	newSiteCmd := &cobra.Command{
		Use:   "site",
		Short: "Create a new site in the provided directory",
		Long:  "The new site will have the correct structure, but no content or theme yet",
		Run:   runFunc,
	}
	newCmd.AddCommand(newSiteCmd)

	newThemeCmd := &cobra.Command{
		Use:   "theme",
		Short: "Create a new theme",
		Long:  "Create a new theme (skeleton) called [name] in the current directory. New theme is a skeleton.",
		Run:   runFunc,
	}
	newCmd.AddCommand(newThemeCmd)

	cmdns.Namespace(hugo)
	cmdns.SetOverrideUsageFunc(false)
	hugo.Execute()
}