helputil

package
v0.0.0-...-2935971 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2022 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package helputil .

A utility for putting help pages in md files and importing them via go embed

to use add a directory called `topic` and go embed it via
```
//go:embed topics/*
var helpTopics embed.FS

func init() {
	htopic.MustAddFS(helpTopics)
}
```

this does not include an implementation of how to get or identify the right file
implementations of a help command will need to figure that out themselves

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(page, text string) bool

Add a help topic, will not overwrite an existing help topic

func AddFS

func AddFS(f fs.FS) error

AddFS adds a list of help topics from a fs.FS

func Get

func Get(page string) (string, bool)

Get a help topic, returns true if a page exists

func List

func List(prefix, suffix, contains string) []string

List gets a list of topics

func MustAdd

func MustAdd(page, text string)

MustAdd is Add but it panics if it fails

func MustAddFS

func MustAddFS(f fs.FS)

MustAddFS is AddFS but it panics if an error occours

Types

This section is empty.

Jump to

Keyboard shortcuts

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