package cmd import ( "fmt" "github.com/kirsle/configdir" "github.com/spf13/cobra" "os" "path/filepath" ) func CustomHelpOutput(cmd *cobra.Command) { cmd.Flags().SortFlags = false cmd.SetHelpTemplate(HelpTemplate) cmd.SetUsageTemplate(UsageTemplate) } func OnlyProfileArgument(cmd *cobra.Command, args []string) error { if len(args) < 1 { return fmt.Errorf("Please, provide PROFILE as the last argument.") } if len(args) > 1 { return fmt.Errorf("You can only have one argument and that should be PROFILE.") } return nil } func ConfigBaseDir() string { return configdir.LocalConfig("akkorder") } func ConfigMinioDir() string { return filepath.Join(ConfigBaseDir(), "minio") } func initConfigPaths() { err := configdir.MakePath(ConfigBaseDir()) // Ensure it exists. if err != nil { panic(err) } os.MkdirAll(filepath.Join(ConfigBaseDir(), "minio"), 0777) }