util

package
v0.0.0-...-cb2bff1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const BASE_COMMAND_INSERT_LINE = `Section to add commands to:`

This should be found in the template_base.txt

View Source
const BASE_COMMAND_TEMPLATE = `template_base.txt`

Variables

View Source
var TemplateFUNctionMap = template.FuncMap{
	"title":   strings.Title,
	"toLower": strings.ToLower,
}

Functions

func AddNewCmdToBaseFile

func AddNewCmdToBaseFile(path string, insertString string, lineNumber int) error

func File2lines

func File2lines(filePath string) ([]string, error)

func FindBaseCommands

func FindBaseCommands(path string) ([]string, error)

func FindLineToInsertCommandTo

func FindLineToInsertCommandTo(path string, search string) (int, error)

func InsertStringToFile

func InsertStringToFile(path, str string, index int) error

*

  • Insert sting to n-th line of file.
  • If you want to insert a line, append newline '\n' to the end of the string.

func LinesFromReader

func LinesFromReader(r io.Reader) ([]string, error)

func NewCmdUtil

func NewCmdUtil(commonOpts *opts.CommonOptions) *cobra.Command

func NewCmdUtilityGenerateFunction

func NewCmdUtilityGenerateFunction(commonOpts *opts.CommonOptions) *cobra.Command

func NewCmdUtilitySearchFile

func NewCmdUtilitySearchFile(commonOpts *opts.CommonOptions) *cobra.Command

func RemoveGoExtension

func RemoveGoExtension(fileName string) string

Types

type SupportedOptions

type SupportedOptions struct {
	UtilOptions
	opts.CommonOptions
}

type UtilGenerateFunctionOptions

type UtilGenerateFunctionOptions struct {
	UtilOptions

	Folder               string
	Filename             string
	TitledFolderFilename string

	LongDescription     string
	ExampleString       string
	CommandUse          string
	ShortDescription    string
	SupportedOptions    SupportedOptions
	ChosenOption        string
	NoExtensionFilename string
	TemplateFile        string
	// contains filtered or unexported fields
}

GetAddonOptions the command line options

func (*UtilGenerateFunctionOptions) Run

Run implements this command

type UtilOptions

type UtilOptions struct {
	*opts.CommonOptions
	Output string
}

func (*UtilOptions) AddUtilFlags

func (o *UtilOptions) AddUtilFlags(cmd *cobra.Command)

func (*UtilOptions) Run

func (o *UtilOptions) Run() error

Run implements this command

type UtilSearchFileOptions

type UtilSearchFileOptions struct {
	UtilOptions

	SearchString string
	SearchFile   string
}

GetAddonOptions the command line options

func (*UtilSearchFileOptions) Run

func (o *UtilSearchFileOptions) Run() error

Run implements this command

Jump to

Keyboard shortcuts

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