package
0.0.0-20211113074651-c6ea6ab4ee08
Repository: https://github.com/tsaikd/kdgolib.git
Documentation: pkg.go.dev

# README

cobrather

Modularized command

  • Simple Module
// Module info
var Module = &cobrather.Module{
	Use: "example",
	Commands: []*cobrather.Module{
		cobrather.VersionModule, // sub command module
	},
}

func main() {
	Module.MustMainRun()
}
  • Custom viper for more config for environment
// Module info
var Module = &cobrather.Module{
	Use: "example",
	Commands: []*cobrather.Module{
		cobrather.VersionModule, // sub command module
	},
}

func main() {
	vr := viper.New()
	vr.AutomaticEnv()
	vr.SetEnvPrefix("ENVPREFIX")
	Module.MustMainRun(
		cobrather.MainRunOptionViper(vr),
	)
}

# Packages

No description provided by the author

# Functions

GenPostRunE generate PostRunE for all modules, start from tail to head.
GenRunE generate RunE for all modules.
ListDeps list all dependent modules recursively.

# Constants

OIncludeCommand list result contains commands in Module.
OIncludeDepInCommand list result contains dependencies in commands, but not commands self.

# Variables

errors.
errors.
erors.
erors.
VersionModule provide module of version, Set nil to disable version command.

# Structs

BoolFlag represents a flag that takes as bool value.
Float64Flag represents a flag that takes as float64 value.
Int64Flag represents a flag that takes as int64 value.
Module for cobra, used for cobra.Command.
StringFlag represents a flag that takes as string value.
StringSliceFlag represents a flag that takes as string value.

# Interfaces

Flag is a common interface related to parsing flags in cobra.
MainRunOption option for Module.MustMainRun.

# Type aliases

ListDepsOption options for ListDeps.
MainRunOptionContext config Context interface for running commands.
MainRunOptionSilenceUsage config SilenceUsage before run, default true.