fscmd

package
Version: v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: CC0-1.0, CC0-1.0, CC0-1.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

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

Cmd represents a command.

func Cmds

func Cmds() []*Cmd

Cmds returns a slice of all available commands, sorted in increasing order by long name.

func Get

func Get(name string) (*Cmd, bool)

Get returns the command with the given name, if any.

func (*Cmd) Description

func (c *Cmd) Description() string

Description returns a brief one-line description of the command.

func (*Cmd) LongName

func (c *Cmd) LongName() string

LongName returns the long form of the command name. If no long form is set, this will be the same as the short form returned by Name.

func (*Cmd) Name

func (c *Cmd) Name() string

Name returns the short form of the command name.

func (*Cmd) Parse

func (c *Cmd) Parse(pwd string, args []string) (RunFunc, error)

Parse attempts to generate a run function from the given command-line arguments.

func (*Cmd) String

func (c *Cmd) String() string

String returns "[Long name, ]Name\tDescription".

type RunFunc

type RunFunc func(context.Context, fs.Interface) error

RunFunc is a function that can be run on the given storage to execute a command.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL