Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConfigCmd = &cobra.Command{ Use: "config", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Configure letme.", Long: `Personalize your letme experience, manage contexts and more.`, Run: func(cmd *cobra.Command, args []string) { cmd.Help() }, }
View Source
var GetContexts = &cobra.Command{ Use: "get-contexts", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Get active and available contexts.", Long: `List all configured contexts in your letme-config file marking the active context with '*'`, Args: cobra.ExactArgs(0), Run: func(cmd *cobra.Command, args []string) { contexts := utils.GetAvalaibleContexts() fmt.Println("Active context marked with '*': ") for _, context := range contexts { currentContext := utils.GetCurrentContext() if context == currentContext { fmt.Println("* " + context) } else { fmt.Println(" " + context) } } os.Exit(0) }, }
View Source
var NewContext = &cobra.Command{ Use: "new-context", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Create a new context.", Long: `Interactively creates a new context in your letme-config file.`, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { contexts := utils.GetAvalaibleContexts() letmeContext := args[0] for _, section := range contexts { if section == letmeContext { fmt.Println("letme: context '" + letmeContext + "' already exists. Modify it with 'letme update-context " + letmeContext + "'.") os.Exit(1) } } utils.NewContext(letmeContext) fmt.Println("Created letme '" + letmeContext + "' context.") os.Exit(0) }, }
View Source
var SwitchContext = &cobra.Command{ Use: "switch-context", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Switch to a context.", Long: `If the context exists, switch to the specified context.`, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { contexts := utils.GetAvalaibleContexts() letmeContext := args[0] for _, section := range contexts { if section == letmeContext { utils.UpdateContext(letmeContext) fmt.Println("Using: '" + letmeContext + "' context.") os.Exit(0) } } fmt.Println("letme: '" + letmeContext + "' context does not exist in your letme-config file.") fmt.Println("letme: run 'letme config new-context " + letmeContext + "' to create it.") os.Exit(1) }, }
View Source
var UpdateContext = &cobra.Command{ Use: "update-context", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Change context values.", Long: `Interactively update an existing context.`, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { contexts := utils.GetAvalaibleContexts() letmeContext := args[0] for _, section := range contexts { if section == letmeContext { utils.NewContext(letmeContext) fmt.Println("letme: updated '" + letmeContext + "' context.") os.Exit(0) } } fmt.Println("letme: '" + letmeContext + "' context does not exist in your letme-config file.") fmt.Println("letme: run 'letme config new-context " + letmeContext + "' to create it.") os.Exit(1) }, }
View Source
var Validate = &cobra.Command{ Use: "validate", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "Validate the config file.", Long: `Validate the config file structure and integrity.`, Args: cobra.ExactArgs(0), Run: func(cmd *cobra.Command, args []string) { homeDir := utils.GetHomeDirectory() if _, err := os.Stat(homeDir + "/.letme/" + "letme-config"); err == nil { result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { utils.TemplateConfigFile(true) } fmt.Println("letme: config file valid.") os.Exit(0) } else { utils.CheckAndReturnError(err) } }, }
View Source
var ViewTemplate = &cobra.Command{ Use: "view-template", PersistentPreRun: func(cmd *cobra.Command, args []string) { utils.LetmeConfigCreate() result := utils.CheckConfigFile(utils.GetHomeDirectory() + "/.letme/letme-config") if !result { fmt.Println("letme: run 'letme config-file --verify' to obtain a template for your config file.") os.Exit(1) } }, Short: "View the a sample configuration file template.", Long: `View the a sample configuration file template, use that as an scaffolding for your needs.`, Args: cobra.ExactArgs(0), Run: func(cmd *cobra.Command, args []string) { utils.TemplateConfigFile(true) os.Exit(0) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.