sitepkg

package module
v0.0.0-...-f42f45f Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

README

go-sitepkg - framework for basic sys-admin utility commands

go-sitepkg implements the common functionality of the primarily perl-based "SitePkg" utilities developed over the last few decades by the Rice Middleware group to manage a wide range of our critical campus services. The sole purpose of go-sitepkg is to ease our transition toward developing Go-based utilities with the same look and feel of our existing utilities.

go-sitepkg is not intended for modern projects - much more appropriate and complete frameworks (Cobra/Viper, Kong, etc. etc.) are available and should be pursued.

Documentation

Index

Constants

View Source
const ConfErrNoSuchOption = "No such option"
View Source
const ConfUseConfig = "ConfUseConfig"

Variables

View Source
var Config = make(Options)
View Source
var ConfigDirs []string
View Source
var DefaultDebug io.Writer = os.Stderr
View Source
var DefaultErr io.Writer = os.Stderr
View Source
var DefaultPrint io.Writer = os.Stdout
View Source
var DefaultShow io.Writer = os.Stdout
View Source
var LocalEtc string
View Source
var Package string
View Source
var PackageDir string
View Source
var PackageEtc string
View Source
var PkgName string
View Source
var PkgVersion string
View Source
var PodMap = make(map[string]string)
View Source
var ProgramName string
View Source
var Verbose, Quiet, Quieter, Debug bool

Functions

func CheckFlagValue

func CheckFlagValue(user_value string, resource_value string, not_specified bool) bool

func ConfigureOptions

func ConfigureOptions() ([]string, error)

func Error

func Error(format string, a ...interface{}) error

func ExecPath

func ExecPath(command string) (command_path string, err error)

func Exit

func Exit(code int, errs ...error)

func FileExists

func FileExists(filename string) (exists bool, err error)

func FindPackageFile

func FindPackageFile(filename string) (pathname string, err error)

func FindPodFile

func FindPodFile() (string, error)

func FindPodText

func FindPodText() (string, error)

func Fprint

func Fprint(w io.Writer, format string, a ...interface{})

func Fprintln

func Fprintln(w io.Writer, format string, a ...interface{})

func Fshow

func Fshow(w io.Writer, format string, a ...interface{})

func Fwarn

func Fwarn(w io.Writer, format string, a ...interface{})

func GetBoolOpt

func GetBoolOpt(name string) (value bool, err error)

func GetCommandPaths

func GetCommandPaths() []string

func GetIntOpt

func GetIntOpt(name string) (value int, err error)

func GetSecret

func GetSecret(account string) (string, error)

func GetStringOpt

func GetStringOpt(name string) (value string, err error)

func GetUintOpt

func GetUintOpt(name string) (value uint, err error)

func InList

func InList(list []string, check_item string) (in_list bool, err error)

func Log

func Log(format string, a ...interface{})

func PackageInit

func PackageInit(pkg_name string, pkg_version string) error

func Print

func Print(format string, a ...interface{})

func Println

func Println(format string, a ...interface{})

func ProcessCommandLine

func ProcessCommandLine() ([]string, error)

func ReadConfigFile

func ReadConfigFile(config_file string) error

func ReadListFromFile

func ReadListFromFile(filename string) (list []string, err error)

func ReadListFromPkgFile

func ReadListFromPkgFile(filename string) (list []string, err error)

func SetBoolOpt

func SetBoolOpt(name string, shortopt string, file bool, value bool, desc string)

func SetIntOpt

func SetIntOpt(name string, shortopt string, file bool, value int, desc string)

func SetStringOpt

func SetStringOpt(name string, shortopt string, file bool, value string, desc string)

func SetUintOpt

func SetUintOpt(name string, shortopt string, file bool, value uint, desc string)

func Show

func Show(format string, a ...interface{})

func ShowConfig

func ShowConfig()

func ShowDebug

func ShowDebug(format string, a ...interface{})

func ShowPod

func ShowPod() error

func ShowVersion

func ShowVersion()

func StringToBool

func StringToBool(s string) (match bool, err error)

func StringToUint

func StringToUint(s string, b int) (uint, error)

func Usage

func Usage()

func Warn

func Warn(format string, a ...interface{})

Types

type Option

type Option struct {
	Type        string
	ShortOpt    string
	ConfigFile  bool
	Desc        string
	StringValue *string
	BoolValue   *bool
	IntValue    *int
	UintValue   *uint
	Source      string
}

type Options

type Options map[string]*Option

Jump to

Keyboard shortcuts

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