doc

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package doc command line help information, [Experimental]

todolist

1. Support direct document generation through registration

2.Support generating documents directly through embedded syntax

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseKv

func ParseKv(line string) (key string, value string)

ParseKv parse kv by line that format matched ":key=value"

Types

type Doc

type Doc struct {
	// [command => help message] current doc text
	CommandHelp []HelpDick `json:"commandHelp"`
	// all text
	// [lang => HelpDick]
	MutilLang map[string][]HelpDick `json:"mutilLang"`
	// all text
	AllText string `json:"allText"`
	// support lang, if not then fist
	LangList []string `json:"langList"`
	// contains filtered or unexported fields
}

func FromLine

func FromLine(content string, langs ...string) *Doc

FromLine parse doc from content by strig line

func (*Doc) Help

func (c *Doc) Help(langs ...string) string

func (*Doc) HelpList

func (c *Doc) HelpList(langs ...string) ([]HelpDick, bool)

func (*Doc) Search

func (c *Doc) Search(cs ...string) (string, bool)

Search help by give command to search

func (*Doc) Support

func (c *Doc) Support(lng string) bool

Support detect if the lang is supported

type HelpDick

type HelpDick struct {
	// command alias
	Alias []string `json:"alias"`
	// command title
	Title string `json:"title"`
	// command option, format like:
	//
	// [file,f => desc], support mutilOption
	Option map[string]string `json:"option"`
	// command help by all text
	AllText string `json:"allText"`
}

Jump to

Keyboard shortcuts

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