usage

package
v0.8.6-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AppHelpTemplate = `` /* 988-byte string literal not displayed */

AppHelpTemplate contains the modified template for the main app

View Source
var CommandHelpTemplate = `` /* 403-byte string literal not displayed */

CommandHelpTemplate contains the modified template for a command

View Source
var HelpCommandAction = cli.ActionFunc(helpAction)

HelpCommandAction is the action function of the overwritten help command.

View Source
var SubcommandHelpTemplate = `` /* 531-byte string literal not displayed */

SubcommandHelpTemplate contains the modified template for a sub command Note that the weird "|||\n|---|---|" syntax sets up a markdown table with empty headers.

Functions

func FlagNamePrefixer

func FlagNamePrefixer(fullName, placeholder string) string

FlagNamePrefixer converts a full flag name and its placeholder into the help message flag prefix. This is used by the default FlagStringer.

This method clones urflave/cli functionality but adds a new line at the end.

func HelpCommand

func HelpCommand() cli.Command

HelpCommand overwrites default urfvafe/cli help command to support one or multiple subcommands like:

step help
step help crypto
step help crypto jwt
step help crypto jwt sign
...

func HelpPrinter

func HelpPrinter(w io.Writer, templ string, data interface{})

HelpPrinter overwrites cli.HelpPrinter and prints the formatted help to the terminal.

func Render

func Render(b []byte) []byte

Render renders the given data with a custom markdown renderer.

Types

type Argument

type Argument struct {
	Required bool
	Multiple bool
	Name     string
	Usage    string
}

Argument specifies the Name, Usage, and whether or not an Argument is required or not

func (Argument) Decorate

func (a Argument) Decorate() string

Decorate returns the name of an Argument and decorates it with notation to indicate whether its required or not

type Arguments

type Arguments []Argument

Arguments is an array of Argument structs that specify which arguments are accepted by a Command

func (Arguments) ArgsUsage

func (args Arguments) ArgsUsage() string

ArgsUsage returns the value of the ArgsUsage property for a cli.Command for these arguments

func (Arguments) UsageText

func (args Arguments) UsageText() string

UsageText returns the value of the UsageText property for a cli.Command for these arguments

type RenderMode

type RenderMode int

RenderMode enumerates different line breaks modes.

const (
	// RenderModeKeepBreaks will keep the line breaks in the docs.
	RenderModeKeepBreaks RenderMode = iota
	// RenderModeBreakLines will automatically wrap the lines.
	RenderModeBreakLines
)

type Renderer

type Renderer struct {
	// contains filtered or unexported fields
}

Renderer implements a custom markdown renderer for blackfriday.

func (*Renderer) RenderFooter

func (r *Renderer) RenderFooter(w io.Writer, ast *md.Node)

RenderFooter implements blackfriday.Renderer interface.

func (*Renderer) RenderHeader

func (r *Renderer) RenderHeader(w io.Writer, ast *md.Node)

RenderHeader implements blackfriday.Renderer interface.

func (*Renderer) RenderNode

func (r *Renderer) RenderNode(w io.Writer, node *md.Node, entering bool) md.WalkStatus

RenderNode implements blackfriday.Renderer interface.

type Report added in v0.8.4

type Report struct {
	Report []*Section `json:"report"`
}

Report holds together a report of sections

func NewReport added in v0.8.4

func NewReport(command string, top []byte) *Report

NewReport returns report based on raw

func (*Report) PerHeadline added in v0.8.4

func (report *Report) PerHeadline(headline string) []Section

PerHeadline returns all sections across commands/pages with the same headline

func (*Report) Process added in v0.8.4

func (report *Report) Process(command string, raw []byte) error

Process adds a html based help page to the report

func (*Report) Write added in v0.8.4

func (report *Report) Write(w io.Writer) error

Write serializes the report to json

type Section added in v0.8.4

type Section struct {
	Command  string     `json:"command"`
	Name     string     `json:"name"`
	Text     string     `json:"text"`
	Words    int        `json:"words"`
	Lines    int        `json:"lines"`
	Sections []*Section `json:"sections"`
}

Section keeps track of individual sections

Jump to

Keyboard shortcuts

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