cmd

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Copyright © 2025 Matt Krueger <mkrueger@rstms.net> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. 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.

  3. 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

This section is empty.

Variables

This section is empty.

Functions

func AppendConfig

func AppendConfig(filename string) error

func CheckErr

func CheckErr(err error)

func CobraAddCommand

func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)

func CobraInit

func CobraInit(cobraRootCmd CobraCommand)

func ConfigDir

func ConfigDir() string

func ConfigEdit

func ConfigEdit()

func ConfigInit

func ConfigInit(allowClobber bool) string

func ConfigString

func ConfigString(header bool) string

func Confirm

func Confirm(prompt string) bool

func Execute

func Execute()

func Expand

func Expand(value string) string

func Fatal

func Fatal(err error) error

func Fatalf

func Fatalf(format string, args ...interface{}) error

func FormatJSON

func FormatJSON(v any) string

func FormatYAML

func FormatYAML(value any) string

func GetHostnameDetail

func GetHostnameDetail() (string, string, string, error)

func HexDump

func HexDump(data []byte) string

func HostDomain

func HostDomain() (string, error)

func HostFQDN

func HostFQDN() (string, error)

func HostShortname

func HostShortname() (string, error)

func Init

func Init(name, version, configFile string)

func IsDir

func IsDir(path string) bool

func IsFile

func IsFile(pathname string) bool

func OptionInt

func OptionInt(cobraCmd CobraCommand, name, flag string, defaultValue int, description string)

func OptionKey

func OptionKey(cobraCmd CobraCommand, key string) string

func OptionString

func OptionString(cobraCmd CobraCommand, name, flag, defaultValue, description string)

func OptionStringSlice

func OptionStringSlice(cobraCmd CobraCommand, name, flag string, defaultValue []string, description string)

func OptionSwitch

func OptionSwitch(cobraCmd CobraCommand, name, flag, description string)

func ProgramName

func ProgramName() string

func ProgramVersion

func ProgramVersion() string

func Shutdown

func Shutdown()

func TildePath

func TildePath(path string) (string, error)

func ViperGet

func ViperGet(key string) any

func ViperGetBool

func ViperGetBool(key string) bool

func ViperGetInt

func ViperGetInt(key string) int

func ViperGetInt64

func ViperGetInt64(key string) int64

func ViperGetString

func ViperGetString(key string) string

func ViperGetStringMapString

func ViperGetStringMapString(key string) map[string]string

func ViperGetStringSlice

func ViperGetStringSlice(key string) []string

func ViperKey

func ViperKey(key string) string

func ViperSet

func ViperSet(key string, value any)

func ViperSetDefault

func ViperSetDefault(key string, value any)

func Warning

func Warning(format string, args ...interface{})

Types

type APIClient

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)
}

func NewAPIClient

func NewAPIClient(prefix, url, certFile, keyFile, caFile string, headers *map[string]string) (APIClient, error)

type CobraCommand

type CobraCommand interface {
}

type Sendmail

type Sendmail interface {
	Send(to, from, subject string, body []byte) error
}

func NewSendmail

func NewSendmail(hostname string, port int, username, password, CAFile string) (Sendmail, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL