man

package
v2.15.3 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 8 Imported by: 0

README

Layout

All man pages follow a common layout that is optimized for presentation on a simple ASCII text display, possibly without any form of highlighting or font control. Sections present may include:[21]: MANUAL STRUCTURE 

NAME

The name of the command or function, followed by a one-line description of what it does.

SYNOPSIS

In the case of a command, a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its declaration.

DESCRIPTION

A textual description of the functioning of the command or function.

EXAMPLES

Some examples of common usage.

SEE ALSO

A list of related commands or functions.


Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, RETURN VALUE, ENVIRONMENT, BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Command

type Command struct {
	Name string

	Example string
	// contains filtered or unexported fields
}

Command represents a command.

func NewCommand

func NewCommand(name string, synopsis, description string) *Command

NewCommand returns a new Command.

func (*Command) AddFlag

func (m *Command) AddFlag(f Flag) error

AddFlag adds a flag to the command.

func (*Command) AddSubCommand

func (m *Command) AddSubCommand(c *Command) error

AddCommand adds a sub-command.

type Flag

type Flag struct {
	Name        string
	EnvVar      string
	Syntax      string
	Description string
}

Flag represents a flag.

func NewFlag

func NewFlag(name, syntax, descr, envvar string) Flag

type ManPage

type ManPage struct {
	Root    Command
	Version string

	Concept       string
	License       string
	Bugs          string
	Files         string
	Authors       []string
	ReportingBugs string
	History       string
	Copyright     string
	Documentation string
	// contains filtered or unexported fields
}

ManPage represents a man page generator.

func NewManPage

func NewManPage(name string, version string, synopsis, description string) *ManPage

NewManPage returns a new ManPage generator instance.

func (*ManPage) AddSection

func (m *ManPage) AddSection(section string, text string)

AddSection adds a section to the man page.

func (*ManPage) WriteTo

func (m *ManPage) WriteTo(wr io.Writer)

type Section

type Section struct {
	Name string
	Text string
}

Section represents a section.

Jump to

Keyboard shortcuts

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