cmd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Copyright © 2024 Zander Hill <zander@xargs.io>

Copyright © 2024 Zander Hill <zander@xargs.io>

Copyright © 2024 Zander Hill <zander@xargs.io>

Copyright © 2024 Zander Hill <zander@xargs.io>

Copyright © 2024 Zander Hill <zander@xargs.io>

Index

Constants

This section is empty.

Variables

View Source
var UsageKey = "USAGE: "

Functions

func ExecRunE

func ExecRunE(cmd *cobra.Command, args []string) error

func Execute

func Execute()

Execute adds all child commands to the root command and sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func ReplaceNameWithExecutableName

func ReplaceNameWithExecutableName(str string) string

func ValidArgsFunctionForScripts

func ValidArgsFunctionForScripts(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

Types

type Config

type Config struct {
}

func NewConfig

func NewConfig() *Config

func (*Config) EnvVarOrViperValue

func (c *Config) EnvVarOrViperValue(val string) string

func (*Config) EnvVarWithSuffix

func (c *Config) EnvVarWithSuffix(suffix string) (string, bool)

func (*Config) ExecutableName

func (c *Config) ExecutableName() string

func (*Config) RootDir

func (c *Config) RootDir() string

type RenameWriter

type RenameWriter struct {
	// contains filtered or unexported fields
}

func (*RenameWriter) Write

func (rw *RenameWriter) Write(p []byte) (n int, err error)

type Script

type Script struct {
	// contains filtered or unexported fields
}

func NewScript

func NewScript(path string, root string) *Script

func (*Script) HasCompletions

func (s *Script) HasCompletions() bool

func (*Script) Help

func (s *Script) Help() string

func (*Script) IsDir

func (s *Script) IsDir() bool

func (*Script) IsExecutable

func (s *Script) IsExecutable() bool

func (*Script) PathSegments

func (s *Script) PathSegments() []string

func (*Script) PathWithoutRoot

func (s *Script) PathWithoutRoot() string

func (*Script) PrintHelp

func (s *Script) PrintHelp()

PrintHelp prints the full help text for the script Help is inclusive of Usage and does not strip out the script name or $0 TODO: consider stripping out leading comment characters such as #, //, etc

func (*Script) PrintUsage

func (s *Script) PrintUsage()

func (*Script) Usage

func (s *Script) Usage() string

Usage returns the usage string for the script after stripping out the script name or $0 this is done to reduce visual noise

type ScriptTemplate

type ScriptTemplate struct {
	ExecutableAlias string
	Root            string
}

Jump to

Keyboard shortcuts

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