cmd

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 License: MIT Imports: 5 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 CheckErr added in v0.1.10

func CheckErr(err error)

func CobraAddCommand added in v0.1.10

func CobraAddCommand(cobraRootCmd, parentCmd, cobraCmd CobraCommand)

func CobraInit added in v0.1.10

func CobraInit(cobraRootCmd CobraCommand)

func ConfigDir added in v0.2.12

func ConfigDir() string

func ConfigEdit added in v0.1.10

func ConfigEdit()

func ConfigInit added in v0.1.10

func ConfigInit(allowClobber bool) string

func ConfigString added in v0.1.10

func ConfigString(header bool) string

func Confirm added in v0.1.10

func Confirm(prompt string) bool

func Execute

func Execute()

func Expand added in v0.1.10

func Expand(value string) string

func Fatal added in v0.1.10

func Fatal(err error) error

func Fatalf added in v0.1.10

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

func FormatJSON added in v0.0.8

func FormatJSON(v any) string

func FormatYAML added in v0.2.10

func FormatYAML(value any) string

func HexDump added in v0.1.10

func HexDump(data []byte) string

func Init added in v0.1.10

func Init(name, version, configFile string)

func IsDir added in v0.0.8

func IsDir(path string) bool

func IsFile added in v0.0.8

func IsFile(pathname string) bool

func OptionInt added in v0.2.4

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

func OptionKey added in v0.1.10

func OptionKey(cobraCmd CobraCommand, key string) string

func OptionString added in v0.0.8

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

func OptionSwitch added in v0.0.8

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

func ProgramName added in v0.1.10

func ProgramName() string

func ProgramVersion added in v0.1.10

func ProgramVersion() string

func Shutdown added in v0.1.10

func Shutdown()

func TildePath added in v0.1.10

func TildePath(path string) (string, error)

func ViperGet added in v0.2.1

func ViperGet(key string) any

func ViperGetBool added in v0.1.10

func ViperGetBool(key string) bool

func ViperGetInt added in v0.1.10

func ViperGetInt(key string) int

func ViperGetInt64 added in v0.1.10

func ViperGetInt64(key string) int64

func ViperGetString added in v0.1.10

func ViperGetString(key string) string

func ViperGetStringMapString added in v0.2.1

func ViperGetStringMapString(key string) map[string]string

func ViperGetStringSlice added in v0.1.10

func ViperGetStringSlice(key string) []string

func ViperKey added in v0.0.8

func ViperKey(key string) string

func ViperSet added in v0.1.10

func ViperSet(key string, value any)

func ViperSetDefault added in v0.1.10

func ViperSetDefault(key string, value any)

func Warning added in v0.1.10

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

Types

type APIClient added in v0.2.1

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 added in v0.2.1

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

type CobraCommand added in v0.1.10

type CobraCommand interface {
}

type Sendmail added in v0.1.10

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

func NewSendmail added in v0.1.10

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