usage

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

AppHelpTemplate contains the modified template for the main app

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

CommandHelpTemplate contains the modified template for a command

View Source
var SubcommandHelpTemplate = `` /* 555-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.

Jump to

Keyboard shortcuts

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