Documentation
¶
Index ¶
- Constants
- Variables
- func FillTemplates(c string, tfMap *TemplateFieldMap) string
- func ParseFileToStringArray(filePath string, parser CommandParser) ([]string, error)
- func ReadShellHistory() ([]string, error)
- func RemoveHistFile() error
- func SetUpHistFile(histCmds []string) error
- type Answerable
- type BashCmdParser
- type CommandParser
- type Snippet
- type SnippetsMeta
- type StepInfo
- type TemplateField
- type TemplateFieldMap
- type ZshCmdParser
Constants ¶
View Source
const ( SHELL_BASH = "bash" SHELL_ZSH = "zsh" SHELL_UNSUPPORTED = "unsupported" )
Variables ¶
View Source
var TempHistFile = "/tmp/corgi.hist"
View Source
var TemplateParamsRegex = `<([^(<>|\s)]+)>`
Functions ¶
func FillTemplates ¶
func FillTemplates(c string, tfMap *TemplateFieldMap) string
func ParseFileToStringArray ¶
func ParseFileToStringArray(filePath string, parser CommandParser) ([]string, error)
func ReadShellHistory ¶
func RemoveHistFile ¶
func RemoveHistFile() error
func SetUpHistFile ¶
Types ¶
type Answerable ¶
type Answerable interface {
AskQuestion(options ...interface{}) error
}
type BashCmdParser ¶
type BashCmdParser struct{}
func (BashCmdParser) Parse ¶
func (b BashCmdParser) Parse(line string) string
type CommandParser ¶
func GetCmdParser ¶
func GetCmdParser(shellType string) (CommandParser, error)
type Snippet ¶
type Snippet struct {
Title string `json:"title"`
Steps []*StepInfo `json:"steps"`
// contains filtered or unexported fields
}
func LoadSnippet ¶
func (*Snippet) AskQuestion ¶
func (*Snippet) GetFilePath ¶
type SnippetsMeta ¶
type SnippetsMeta struct {
Snippets []*jsonSnippet `json:"snippets"`
// contains filtered or unexported fields
}
func LoadSnippetsMeta ¶
func LoadSnippetsMeta(filePath string) (*SnippetsMeta, error)
func (*SnippetsMeta) FindSnippet ¶
func (sm *SnippetsMeta) FindSnippet(title string) (*Snippet, error)
func (*SnippetsMeta) Save ¶
func (sm *SnippetsMeta) Save() error
func (*SnippetsMeta) SaveNewSnippet ¶
func (sm *SnippetsMeta) SaveNewSnippet(snippet *Snippet, snippetsDir string) error
Save new snippet into snippetsDir and update snippets meta file
type StepInfo ¶
type StepInfo struct {
Command string `json:"command"`
Description string `json:"description,omitempty"`
ExecuteConcurrent bool `json:"execute_concurrent"`
}
func NewStepInfo ¶
func (*StepInfo) AskQuestion ¶
type TemplateField ¶
type TemplateField struct {
FieldName string `json:"field_name"`
Value string `json:"default_value"`
}
func (*TemplateField) AskQuestion ¶
func (tf *TemplateField) AskQuestion(options ...interface{}) error
type TemplateFieldMap ¶
type TemplateFieldMap map[string]*TemplateField
func ParseTemplateFields ¶
func ParseTemplateFields(c string) TemplateFieldMap
func (TemplateFieldMap) AddTemplateField ¶
func (tfMap TemplateFieldMap) AddTemplateField(t *TemplateField)
type ZshCmdParser ¶
type ZshCmdParser struct{}
func (ZshCmdParser) Parse ¶
func (z ZshCmdParser) Parse(line string) string
Click to show internal directories.
Click to hide internal directories.