Documentation
¶
Index ¶
- Constants
- Variables
- func CloseBodyReader(rc io.ReadCloser)
- func Load() bool
- func LoadModules(configFile string) bool
- func SetDocType(doc string)
- func SetVerboseLogging()
- func ShowCommand(module, cmd, subCmd string) (*parser.Method, error)
- func ShowCommands(module string) error
- func ShowModuleCommands(m *Module)
- func ShowModules()
- func ShowTaggedCommands(cmd string)
- type Config
- type DocProvider
- type DocProviderNone
- type DocProviderShell
- type DocType
- type Level
- type Log
- func (l *Log) Debug(v ...any)
- func (l *Log) Debugf(format string, v ...any)
- func (l *Log) Error(v ...any)
- func (l *Log) Errorf(format string, v ...any)
- func (l *Log) Fatal(v ...any)
- func (l *Log) FatalIf(err error)
- func (l *Log) Fatalf(format string, v ...any)
- func (l *Log) GetPlainLogger() *log.Logger
- func (l *Log) HttpRequest(req *http.Request)
- func (l *Log) HttpResponse(resp *http.Response, body []byte)
- func (l *Log) Info(v ...any)
- func (l *Log) IsInfo() bool
- func (l *Log) IsVerbose() bool
- func (l *Log) Printf(format string, v ...any)
- func (l *Log) Println(v ...any)
- func (l *Log) SetDocType(dt string)
- func (l *Log) SetLevel(value Level)
- func (l *Log) Successf(format string, v ...any)
- type Module
- type ModuleConfig
- type Profile
- type Proxy
- type Server
- type TokenCache
Constants ¶
View Source
const ( ConfigDir = ".tcli" DataDir = "data" EnvConfigRoot = "TCLI_CONFIG_ROOT" EnvConfigFile = "TCLI_CONFIG_FILE" ConfigFileName = "config.yaml" ModuleFileName = "modules.yaml" )
View Source
const (
TokenFile = ".token"
)
Variables ¶
View Source
var ( DefaultHomeDir = getHomeDir() DefaultConfigRoot = filepath.Join(DefaultHomeDir, ConfigDir) DefaultConfigFile = filepath.Join(getConfigRoot(), ConfigFileName) )
View Source
var ( // cache file path TokenCacheFile = fmt.Sprintf("%s/%s", getConfigDir(), TokenFile) )
Functions ¶
func LoadModules ¶
func ShowCommands ¶
show supported commands in the specified module
func ShowModuleCommands ¶
func ShowModuleCommands(m *Module)
func ShowModules ¶
func ShowModules()
func ShowTaggedCommands ¶
func ShowTaggedCommands(cmd string)
Types ¶
type Config ¶
type Config struct {
ProfileName string `yaml:"default_profile"`
Profiles []Profile `yaml:"profiles"`
ModuleConfig string `yaml:"module_config"`
CurrentProfile *Profile
Modules []Module
TokenCache *TokenCache
}
Config holds all profiles and overrides to current profile
type DocProvider ¶
type DocProvider interface {
// initialize, set a handler
Init() error
// provide docs for http request
HttpRequest(*http.Request)
// provide docs for http response
HttpResponse(*http.Response, []byte)
}
define interface for document generation
func NewDocProvider ¶
func NewDocProvider(dt string) DocProvider
type DocProviderNone ¶
type DocProviderNone struct {
}
func (*DocProviderNone) HttpRequest ¶
func (d *DocProviderNone) HttpRequest(req *http.Request)
func (*DocProviderNone) HttpResponse ¶
func (d *DocProviderNone) HttpResponse(resp *http.Response, body []byte)
func (*DocProviderNone) Init ¶
func (d *DocProviderNone) Init() error
type DocProviderShell ¶
type DocProviderShell struct {
}
func (*DocProviderShell) HttpRequest ¶
func (d *DocProviderShell) HttpRequest(req *http.Request)
print curl request
func (*DocProviderShell) HttpResponse ¶
func (d *DocProviderShell) HttpResponse(resp *http.Response, body []byte)
func (*DocProviderShell) Init ¶
func (d *DocProviderShell) Init() error
type Log ¶
type Log struct {
// contains filtered or unexported fields
}
func InitLogger ¶
func (*Log) Error ¶
this function is here for a possible decoration for errors right now, its the same as Println
func (*Log) GetPlainLogger ¶
func (*Log) HttpRequest ¶
some specialized logging for http requests and responses
type Module ¶
type Module struct {
Name string `yaml:"name"`
ConfigFile string `yaml:"config"`
Description string `yaml:"description"`
ConfigRoot *parser.Root
}
module config
func GetCurrentModule ¶
func GetCurrentModule() *Module
func (*Module) LoadConfig ¶
type ModuleConfig ¶
type ModuleConfig struct {
Modules []Module `yaml:"modules"`
}
type TokenCache ¶
type TokenCache struct {
// contains filtered or unexported fields
}
func NewTokenCache ¶
func NewTokenCache() *TokenCache
Click to show internal directories.
Click to hide internal directories.