Documentation ¶
Index ¶
- Constants
- func GenerateMarkdownTree(rootOutputPath string, cmd *cobra.Command) error
- func IsCmdErr(err error) bool
- func SetClientHook(rootCmd *cobra.Command, applyFunc func(cmd *cobra.Command))
- func SetCompletionCmd(exec string) *cobra.Command
- func SetHelp(cmd *cobra.Command)
- func SetHelpTopicCmd(title string, topic map[string]string) *cobra.Command
- func SetRefCmd(root *cobra.Command) *cobra.Command
- type Config
- type ConfigLoaderOpt
Constants ¶
const ( RAYSTACK_CONFIG_DIR = "RAYSTACK_CONFIG_DIR" XDG_CONFIG_HOME = "XDG_CONFIG_HOME" APP_DATA = "AppData" LOCAL_APP_DATA = "LocalAppData" )
const ( USAGE = "Usage" CORECMD = "Core commands" HELPCMD = "Help topics" OTHERCMD = "Other commands" FLAGS = "Flags" IFLAGS = "Inherited flags" ARGUMENTS = "Arguments" EXAMPLES = "Examples" ENVS = "Environment variables" LEARN = "Learn more" FEEDBACK = "Feedback" )
Variables ¶
This section is empty.
Functions ¶
func GenerateMarkdownTree ¶
GenerateMarkdownTree generate cobra cmd commands tree as markdown file rootOutputPath determines the folder where the markdown files are written
func IsCmdErr ¶
IsCmdErr returns true if erorr is cobra command error. This is useful for distinguishing between a human error and a program error and displaying the correct message.
func SetClientHook ¶
SetClientHook applies custom cobra config specific for client or cmd that have annotation `client:true`
func SetCompletionCmd ¶
SetCompletionCmd is used to generate the completion script in bash, zsh, fish, and powershell. It should be added on the root command and can be used as `completion bash` or `completion zsh`.
func SetHelp ¶
SetHelp sets a custom help and usage function. It allows to group commands in different sections based on cobra commands annotations.
func SetHelpTopicCmd ¶
SetHelpTopicCmd sets the help topic command. This should be added on the root command. e.g.
topic := map[string]string{"short": "Env","long": "Environment","example": "example",}
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func SetConfig ¶
SetConfig allows to set a client config file. It is used to load and save a config file for command line clients.
func (*Config) Load ¶
func (c *Config) Load(cfg interface{}, opts ...ConfigLoaderOpt) error
type ConfigLoaderOpt ¶
type ConfigLoaderOpt func(c *Config)
func WithFlags ¶
func WithFlags(pfs *pflag.FlagSet) ConfigLoaderOpt
func WithLoaderOptions ¶ added in v0.4.0
func WithLoaderOptions(opts ...config.LoaderOption) ConfigLoaderOpt