Documentation ¶
Index ¶
- Variables
- func CheckFingerprints(ctx context.Context, addresses []string) error
- func Execute(version, commit, buildTime string)
- func GetCertFingerprint(cmd *cobra.Command, args []string) error
- func Must(err error)
- func Perform(action string, fn func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string)
- func SetupRouter(ctx context.Context) *chi.Mux
- type FlagBuilder
- func (fb *FlagBuilder) AddCommand(command *cobra.Command) *FlagBuilder
- func (fb *FlagBuilder) Bind(key string) *FlagBuilder
- func (fb *FlagBuilder) Bool(key string, defaultValue bool, description string) *FlagBuilder
- func (fb *FlagBuilder) Concat(builders ...*FlagBuilder) *FlagBuilder
- func (fb *FlagBuilder) Duration(key string, defaultValue time.Duration, description string) *FlagBuilder
- func (fb *FlagBuilder) Env(env string) *FlagBuilder
- func (fb *FlagBuilder) Flag() *FlagBuilder
- func (fb *FlagBuilder) Float64(key string, defaultValue float64, description string) *FlagBuilder
- func (fb *FlagBuilder) Int(key string, defaultValue int, description string) *FlagBuilder
- func (fb *FlagBuilder) Require() *FlagBuilder
- func (fb *FlagBuilder) SetKey(key string) *FlagBuilder
- func (fb *FlagBuilder) String(key string, defaultValue string, description string) *FlagBuilder
- func (fb *FlagBuilder) StringSlice(key string, defaultValue []string, description string) *FlagBuilder
- func (fb *FlagBuilder) Uint(key string, defaultValue uint, description string) *FlagBuilder
Constants ¶
This section is empty.
Variables ¶
var GenerateCmd = &cobra.Command{
Use: "generate",
Short: "entrypoint to generate subcommands",
}
GenerateCmd is the generate command
var ( // GetCertFingerprintCmd is the GetCertFingerprint command GetCertFingerprintCmd = &cobra.Command{ Use: "get-cert-fingerprint", Short: "A helper for fetching tls fingerprint info for pinning", Run: Perform("get cert fingerprint", GetCertFingerprint), } )
var JSONSchemaCmd = &cobra.Command{ Use: "json-schema", Short: "entrypoint to generate json schema for project", Run: Perform("generate json schema", jsonSchemaRun), }
JSONSchemaCmd is the json schema command
var ( // RootCmd is the base command (what the binary is called) RootCmd = &cobra.Command{ Use: "bat-go", Short: "bat-go provides go based services and processes for BAT", } )
var ServeCmd = &cobra.Command{
Use: "serve",
Short: "entrypoint to serve a micro-service",
}
ServeCmd the serve command
var VersionCmd = &cobra.Command{
Use: "version",
Short: "get the version of this binary",
Run: versionRun,
}
VersionCmd is the command to get the code's version information
Functions ¶
func CheckFingerprints ¶ added in v0.4.0
CheckFingerprints checks the fingerprints at the following address
func Execute ¶
func Execute(version, commit, buildTime string)
Execute - the main entrypoint for all subcommands in bat-go
func GetCertFingerprint ¶ added in v0.4.0
GetCertFingerprint runs the command for GetCertFingerprint
Types ¶
type FlagBuilder ¶ added in v0.4.0
type FlagBuilder struct {
// contains filtered or unexported fields
}
FlagBuilder creates a flag builder
func NewFlagBuilder ¶ added in v0.4.0
func NewFlagBuilder(command *cobra.Command) *FlagBuilder
NewFlagBuilder creates a new FlagBuilder from one command
func (*FlagBuilder) AddCommand ¶ added in v0.4.0
func (fb *FlagBuilder) AddCommand(command *cobra.Command) *FlagBuilder
AddCommand adds a command
func (*FlagBuilder) Bind ¶ added in v0.4.0
func (fb *FlagBuilder) Bind(key string) *FlagBuilder
Bind runs the BindPFlag function
func (*FlagBuilder) Bool ¶ added in v0.4.0
func (fb *FlagBuilder) Bool(key string, defaultValue bool, description string) *FlagBuilder
Bool attaches a bool flag to the command
func (*FlagBuilder) Concat ¶ added in v0.4.0
func (fb *FlagBuilder) Concat(builders ...*FlagBuilder) *FlagBuilder
Concat combine flag builders
func (*FlagBuilder) Duration ¶ added in v0.5.0
func (fb *FlagBuilder) Duration(key string, defaultValue time.Duration, description string) *FlagBuilder
Duration attaches a string flag to the command
func (*FlagBuilder) Env ¶ added in v0.4.0
func (fb *FlagBuilder) Env(env string) *FlagBuilder
Env attaches an env
func (*FlagBuilder) Flag ¶ added in v0.4.0
func (fb *FlagBuilder) Flag() *FlagBuilder
Flag resets the builder to allow for chaining
func (*FlagBuilder) Float64 ¶ added in v0.4.0
func (fb *FlagBuilder) Float64(key string, defaultValue float64, description string) *FlagBuilder
Float64 attaches a float64 type flag to the command
func (*FlagBuilder) Int ¶ added in v0.4.0
func (fb *FlagBuilder) Int(key string, defaultValue int, description string) *FlagBuilder
Int attaches an int flag to the command
func (*FlagBuilder) Require ¶ added in v0.4.0
func (fb *FlagBuilder) Require() *FlagBuilder
Require requires the flag
func (*FlagBuilder) SetKey ¶ added in v0.4.0
func (fb *FlagBuilder) SetKey(key string) *FlagBuilder
SetKey sets the key to be shared across methods
func (*FlagBuilder) String ¶ added in v0.4.0
func (fb *FlagBuilder) String(key string, defaultValue string, description string) *FlagBuilder
String attaches a string flag to the command
func (*FlagBuilder) StringSlice ¶ added in v0.4.0
func (fb *FlagBuilder) StringSlice(key string, defaultValue []string, description string) *FlagBuilder
StringSlice attaches a string slice flag to the command
func (*FlagBuilder) Uint ¶ added in v0.4.0
func (fb *FlagBuilder) Uint(key string, defaultValue uint, description string) *FlagBuilder
Uint attaches an uint flag to the command