Documentation
¶
Index ¶
- type Section
- func (s *Section) CommandsAsString() string
- func (s *Section) FlagsAsString() string
- func (s *Section) IsForCommand(command string) bool
- func (s *Section) IsForFlag(flag string) bool
- func (s *Section) IsForTopic(topic string) bool
- func (s *Section) SetCommandsFromString(commands string)
- func (s *Section) SetFlagsFromString(flags string)
- func (s *Section) SetTopicsFromString(topics string)
- func (s *Section) TopicsAsString() string
- func (s *Section) Validate() error
- type SectionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Section ¶
type Section struct {
ID int64 `json:"id,omitempty"`
Slug string `json:"slug"`
SectionType SectionType `json:"section_type"`
Title string `json:"title"`
SubTitle string `json:"sub_title"`
Short string `json:"short"`
Content string `json:"content"`
// Metadata for searching and filtering
Topics []string `json:"topics"`
Flags []string `json:"flags"`
Commands []string `json:"commands"`
// Display options
IsTopLevel bool `json:"is_top_level"`
IsTemplate bool `json:"is_template"`
ShowPerDefault bool `json:"show_per_default"`
Order int `json:"order"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
// Back-reference to the help system (not stored in database)
// Using interface{} to avoid circular dependency
HelpSystem interface{} `json:"-" yaml:"_"`
}
Section represents a help section with all its metadata
func (*Section) CommandsAsString ¶
CommandsAsString returns commands as a comma-separated string
func (*Section) FlagsAsString ¶
FlagsAsString returns flags as a comma-separated string
func (*Section) IsForCommand ¶
IsForCommand checks if the section is related to a specific command
func (*Section) IsForTopic ¶
IsForTopic checks if the section is related to a specific topic
func (*Section) SetCommandsFromString ¶
SetCommandsFromString sets commands from a comma-separated string
func (*Section) SetFlagsFromString ¶
SetFlagsFromString sets flags from a comma-separated string
func (*Section) SetTopicsFromString ¶
SetTopicsFromString sets topics from a comma-separated string
func (*Section) TopicsAsString ¶
TopicsAsString returns topics as a comma-separated string
type SectionType ¶
type SectionType int
SectionType represents the type of a help section
const ( SectionGeneralTopic SectionType = iota SectionExample SectionApplication SectionTutorial )
func SectionTypeFromString ¶
func SectionTypeFromString(s string) (SectionType, error)
SectionTypeFromString converts a string to a SectionType
func (SectionType) String ¶
func (s SectionType) String() string
String returns the string representation of a SectionType
func (SectionType) ToInt ¶
func (s SectionType) ToInt() int
ToInt returns the integer value of a SectionType