Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{
Use: "sman",
Short: "CLI Snippet Manager (" + version + ")",
Long: ``,
}
RootCmd for cobra
Functions ¶
Types ¶
type Placeholder ¶
Placeholder struct
func (*Placeholder) AddPattern ¶
func (p *Placeholder) AddPattern(pattern string)
AddPattern adds new pattern to Patterns slice if not exists
func (*Placeholder) DisplayName ¶
func (p *Placeholder) DisplayName() string
DisplayName returns formatted name
func (*Placeholder) ParseOptions ¶
func (p *Placeholder) ParseOptions(in string)
ParseOptions splits string by comma and sets Options value
func (*Placeholder) SetInput ¶
func (p *Placeholder) SetInput(input string)
SetInput sets input variable of Placeholder. If input is string and Placeholder has options, we try to set option value. The same way, if input is empty we try to set first option as input, assuming default value.
type Snippet ¶
type Snippet struct {
Desc, Command, Name, Do, File string
Tags []string
Placeholders []Placeholder
}
Snippet struct
func (*Snippet) DisplayCommand ¶
DisplayCommand returns formatted command
func (*Snippet) ParseCommand ¶
func (s *Snippet) ParseCommand()
ParseCommand reads snippet command and creates Placeholders instance
func (*Snippet) ReplacePlaceholders ¶
func (s *Snippet) ReplacePlaceholders()
ReplacePlaceholders replaces placeholders patterns by placeholders input
type SnippetSlice ¶
type SnippetSlice []Snippet
SnippetSlice for sorting
func (SnippetSlice) Len ¶
func (s SnippetSlice) Len() int
func (SnippetSlice) Less ¶
func (s SnippetSlice) Less(a, b int) bool
func (SnippetSlice) Swap ¶
func (s SnippetSlice) Swap(a, b int)
Click to show internal directories.
Click to hide internal directories.