docs

package module
v3.0.0-alpha5 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 13 Imported by: 0

README

Welcome to urfave/cli-docs/v3

Run Tests Go Reference Go Report Card

urfave/cli-docs/v3 is an extended documentation library for use with urfave/cli/v3.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MarkdownDocTemplate = `{{if gt .SectionNum 0}}% {{ .Command.Name }} {{ .SectionNum }}

{{end}}# NAME

{{ .Command.Name }}{{ if .Command.Usage }} - {{ .Command.Usage }}{{ end }}

# SYNOPSIS

{{ .Command.Name }}
{{ if .SynopsisArgs }}
` + "```" + `
{{ range $v := .SynopsisArgs }}{{ $v }}{{ end }}` + "```" + `
{{ end }}{{ if .Command.Description }}
# DESCRIPTION

{{ .Command.Description }}
{{ end }}
**Usage**:

` + "```" + `{{ if .Command.UsageText }}
{{ .Command.UsageText }}
{{ else }}
{{ .Command.Name }} [GLOBAL OPTIONS] [command [COMMAND OPTIONS]] [ARGUMENTS...]
{{ end }}` + "```" + `
{{ if .GlobalArgs }}
# GLOBAL OPTIONS
{{ range $v := .GlobalArgs }}
{{ $v }}{{ end }}
{{ end }}{{ if .Commands }}
# COMMANDS
{{ range $v := .Commands }}
{{ $v }}{{ end }}{{ end }}`
View Source
var MarkdownTabularDocTemplate = `{{ define "flags" }}
| Name | Description | Default value | Environment variables |
|------|-------------|:-------------:|:---------------------:|
{{   range $flag := . -}}
{{- /**/ -}} | ` + "`" + `{{ $flag.Name }}{{ if $flag.TakesValue }}="…"{{ end }}` + "`" + ` {{ if $flag.Aliases }}(` + "`" + `{{ join $flag.Aliases "` + "`, `" + `" }}` + "`" + `) {{ end }}
{{- /**/ -}} | {{ $flag.Usage }}
{{- /**/ -}} | {{ if $flag.Default }}` + "`" + `{{ $flag.Default }}` + "`" + `{{ end }}
{{- /**/ -}} | {{ if $flag.EnvVars }}` + "`" + `{{ join $flag.EnvVars "` + "`, `" + `" }}` + "`" + `{{ else }}*none*{{ end }}
{{- /**/ -}} |
{{   end }}
{{ end }}

{{ define "command" }}
### ` + "`" + `{{ .Name }}` + "`" + ` {{ if gt .Level 0 }}sub{{ end }}command{{ if .Aliases }} (aliases: ` + "`" + `{{ join .Aliases "` + "`, `" + `" }}` + "`" + `){{ end }}
{{   if .Usage }}
{{     .Usage }}.
{{   end }}
{{   if .UsageText }}
{{     range $line := .UsageText -}}
> {{ $line }}
{{     end -}}
{{   end }}
{{   if .Description }}
{{     .Description }}.
{{   end }}
Usage:

` + "```" + `bash
$ {{ .AppPath }} [GLOBAL FLAGS] {{ .Name }}{{ if .Flags }} [COMMAND FLAGS]{{ end }} {{ if .ArgsUsage }}{{ .ArgsUsage }}{{ else }}[ARGUMENTS...]{{ end }}
` + "```" + `

{{   if .Flags -}}
The following flags are supported:
{{     template "flags" .Flags }}
{{   end -}}

{{   if .SubCommands -}}
{{     range $subCmd := .SubCommands -}}
{{       template "command" $subCmd }}
{{     end -}}
{{   end -}}
{{ end }}

## CLI interface{{ if .Name }} - {{ .Name }}{{ end }}

{{ if .Description }}{{ .Description }}.
{{ end }}
{{ if .Usage }}{{ .Usage }}.
{{ end }}
{{ if .UsageText }}
{{   range $line := .UsageText -}}
> {{ $line }}
{{   end -}}
{{ end }}
Usage:

` + "```" + `bash
$ {{ .AppPath }}{{ if .GlobalFlags }} [GLOBAL FLAGS]{{ end }} [COMMAND] [COMMAND FLAGS] {{ if .ArgsUsage }}{{ .ArgsUsage }}{{ else }}[ARGUMENTS...]{{ end }}
` + "```" + `

{{ if .GlobalFlags }}
Global flags:

{{ template "flags" .GlobalFlags }}

{{ end -}}
{{ if .Commands -}}
{{   range $cmd := .Commands -}}
{{     template "command" $cmd }}
{{   end }}
{{- end }}`

Functions

func ToMan

func ToMan(cmd *cli.Command) (string, error)

ToMan creates a man page string for the `*cli.Command` The function errors if either parsing or writing of the string fails.

func ToManWithSection

func ToManWithSection(cmd *cli.Command, sectionNumber int) (string, error)

ToMan creates a man page string with section number for the `*cli.Command` The function errors if either parsing or writing of the string fails.

func ToMarkdown

func ToMarkdown(cmd *cli.Command) (string, error)

ToMarkdown creates a markdown string for the `*cli.Command` The function errors if either parsing or writing of the string fails.

func ToTabularMarkdown

func ToTabularMarkdown(cmd *cli.Command, appPath string) (string, error)

ToTabularMarkdown creates a tabular markdown documentation for the `*cli.Command`. The function errors if either parsing or writing of the string fails.

func ToTabularToFileBetweenTags

func ToTabularToFileBetweenTags(cmd *cli.Command, appPath, filePath string, startEndTags ...string) error

ToTabularToFileBetweenTags creates a tabular markdown documentation for the `*App` and updates the file between the tags in the file. The function errors if either parsing or writing of the string fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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