Documentation
¶
Overview ¶
Package help holds the help texts of sind: what its words mean, what each action of sind ui does, what each page shows and how to do common things. The texts are YAML files in this directory, embedded in the binary. sind help TOPIC prints them and sind ui shows them as hint cards, in its help pane and in the jump box, so that both say the same.
Load checks the files for the faults that a program cannot repair: an empty field, an id twice, a reference to an id that does not exist. The tests of this package and of cmd/sind check the rest: that every action and page of sind ui has an entry, that each docs link exists and that each command in the texts is one that sind has.
Index ¶
- Constants
- func DocURL(doc string) string
- func UIDocURL(doc string) string
- type Action
- type Help
- func (h *Help) Action(id string) (Action, bool)
- func (h *Help) Actions() []Action
- func (h *Help) Commands() []string
- func (h *Help) Howto(id string) (Howto, bool)
- func (h *Help) Howtos() []Howto
- func (h *Help) Index(skip func(id string) bool) string
- func (h *Help) Page(id string) (Page, bool)
- func (h *Help) PageFor(path string) (Page, bool)
- func (h *Help) Pages() []Page
- func (h *Help) Search(q string) []Hit
- func (h *Help) Text(id string) (string, bool)
- func (h *Help) Topic(id string) (Kind, bool)
- func (h *Help) Word(id string) (Word, bool)
- func (h *Help) Words() []Word
- type Hit
- type Howto
- type Kind
- type Page
- type Word
Constants ¶
const DocsURL = "https://gsi-hpc.github.io/sind/"
DocsURL is where the Hugo docs of sind are published; the doc fields are paths below its root.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Summary string `yaml:"summary"`
// Command is the sind command that the action runs, with placeholders
// in capitals.
Command string `yaml:"command"`
// Undo says how to take the action back, or that nobody can.
Undo string `yaml:"undo"`
// Irreversible marks an action that cannot be undone.
Irreversible bool `yaml:"irreversible"`
// NothingToUndo marks an action that leaves nothing to undo, such as
// a restart.
NothingToUndo bool `yaml:"nothingToUndo"`
Doc string `yaml:"doc"`
Words []string `yaml:"words"`
}
Action is a button of sind ui that changes something.
type Help ¶
type Help struct {
// contains filtered or unexported fields
}
Help is the set of all help texts.
func Default ¶
func Default() *Help
Default returns the embedded texts, loaded once. It panics when they are faulty, which a test of this package prevents.
func Load ¶
Load reads words.yaml, actions.yaml, pages.yaml and howtos.yaml from fsys and checks them.
func (*Help) Commands ¶
Commands returns every command line in the texts, for the tests that check them against the command tree.
func (*Help) Index ¶
Index returns the list of topics that sind help can print: every topic but those for which skip, unless nil, reports true. sind help prints the help of a command for a topic of the command's name, so it skips those. The titles line up in one column, after the longest id.
func (*Help) PageFor ¶
PageFor returns the page that serves the URL path, such as /clusters/sind/dev. A route's {wildcard} matches one segment.
func (*Help) Search ¶
Search finds the entries that match every word of q, best first: a title that starts with the query, then a title that holds it, then the rest. Pages are not searched, as the jump box lists them itself.
func (*Help) Text ¶
Text returns the topic id as plain text for a terminal, as sind help ID prints it.
type Howto ¶
type Howto struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Summary string `yaml:"summary"`
Steps []string `yaml:"steps"`
Commands []string `yaml:"commands"`
Doc string `yaml:"doc"`
Words []string `yaml:"words"`
}
Howto is a way to reach a goal, step by step.
type Page ¶
type Page struct {
ID string `yaml:"id"`
Title string `yaml:"title"`
Summary string `yaml:"summary"`
// Route is the path of the page, with {wildcards}.
Route string `yaml:"route"`
Doc string `yaml:"doc"`
Words []string `yaml:"words"`
Howtos []string `yaml:"howtos"`
}
Page is a page of sind ui.