Documentation
¶
Overview ¶
Copyright © 2025 Matt Krueger <[email protected]> All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- Constants
- Variables
- func AppendConfig(filename string) error
- func CheckErr(err error)
- func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)
- func CobraInit(cobraRootCmd CobraCommand)
- func ConfigDir() string
- func ConfigEdit()
- func ConfigInit(allowClobber bool) string
- func ConfigString(header bool) string
- func Confirm(prompt string) bool
- func Expand(value string) string
- func Fatal(err error) error
- func Fatalf(format string, args ...interface{}) error
- func FormatJSON(v any) string
- func FormatYAML(value any) string
- func GetHostnameDetail() (string, string, string, error)
- func HexDump(data []byte) string
- func HostDomain() (string, error)
- func HostFQDN() (string, error)
- func HostShortname() (string, error)
- func Init(name, version, configFile string)
- func IsDir(path string) bool
- func IsFile(pathname string) bool
- func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)
- func OptionKey(cobraCmd CobraCommand, key string) string
- func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)
- func OptionStringSlice(cobraCmd CobraCommand, name, flag string, defaultValue []string, ...)
- func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)
- func ProgramName() string
- func ProgramVersion() string
- func Shutdown()
- func TildePath(path string) (string, error)
- func ViperGet(key string) any
- func ViperGetBool(key string) bool
- func ViperGetInt(key string) int
- func ViperGetInt64(key string) int64
- func ViperGetString(key string) string
- func ViperGetStringMap(key string) map[string]any
- func ViperGetStringMapString(key string) map[string]string
- func ViperGetStringSlice(key string) []string
- func ViperKey(key string) string
- func ViperSet(key string, value any)
- func ViperSetDefault(key string, value any)
- func Warning(format string, args ...interface{})
- type APIClient
- type CobraCommand
- type Sendmail
- type SendmailClient
Constants ¶
const DEFAULT_DISABLE_KEEPALIVES = false
const DEFAULT_IDLE_CONN_TIMEOUT = 5
const Version = "0.2.71"
Variables ¶
var ConfirmAcceptMessage = "Proceeding"
var ConfirmRejectMessage = "Cowardly refused"
var LogFile *os.File
Functions ¶
func AppendConfig ¶ added in v0.2.37
func CobraAddCommand ¶ added in v0.1.30
func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)
call from non-root cobra command init
func CobraInit ¶ added in v0.1.26
func CobraInit(cobraRootCmd CobraCommand)
call from root cobra command init
func ConfigEdit ¶ added in v0.1.26
func ConfigEdit()
func ConfigInit ¶ added in v0.1.26
func ConfigString ¶ added in v0.1.26
func FormatJSON ¶
func FormatYAML ¶ added in v0.2.30
func HostDomain ¶ added in v0.2.41
func HostShortname ¶ added in v0.2.41
func Init ¶ added in v0.1.2
func Init(name, version, configFile string)
call Init if not using cobra
func OptionInt ¶ added in v0.2.23
func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)
func OptionKey ¶ added in v0.1.26
func OptionKey(cobraCmd CobraCommand, key string) string
func OptionString ¶ added in v0.1.26
func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)
func OptionStringSlice ¶ added in v0.2.35
func OptionStringSlice(cobraCmd CobraCommand, name, flag string, defaultValue []string, description string)
func OptionSwitch ¶ added in v0.1.26
func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)
func ProgramName ¶
func ProgramName() string
func ProgramVersion ¶ added in v0.1.2
func ProgramVersion() string
func ViperGetBool ¶
func ViperGetInt ¶
func ViperGetInt64 ¶
func ViperGetString ¶
func ViperGetStringMap ¶ added in v0.2.70
func ViperGetStringMapString ¶ added in v0.2.19
func ViperGetStringSlice ¶ added in v0.1.11
func ViperSetDefault ¶
Types ¶
type APIClient ¶ added in v0.2.3
type APIClient interface {
Close()
Get(path string, response interface{}) (string, error)
Post(path string, request, response interface{}, headers *map[string]string) (string, error)
Put(path string, request, response interface{}, headers *map[string]string) (string, error)
Delete(path string, response interface{}) (string, error)
SetFlag(string, bool) error
StatusCode() (int, bool)
}
type CobraCommand ¶ added in v0.1.30
type CobraCommand interface {
}