package cmd import ( "fmt" "os" "github.com/spf13/cobra" ) var rootCmd = &cobra.Command{ Use: "drogobox", Short: "DroGoBox is just a dumb project", Long: `DroGoBox is just a dumb project an alternative to Nextcloud written with Go so that I can learn Go. Don't trust it for production. Maybe one day, but that day is not today.`, Run: func(cmd *cobra.Command, args []string) { // Do stuff here }, } var listCmd = &cobra.Command{ Use: "list [directory]", Short: "List the contents of a directory", Args: cobra.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { name := "world" fmt.Printf("Hello, %s!\n", name) return nil }, } func Execute() { if err := rootCmd.Execute(); err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) } } func init() { rootCmd.AddCommand(listCmd) }