subcommand

package
v3.6.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2014 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

A simple sub command parser based on the flag package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(commands ...SubCommand)

Types

type SubCommand

type SubCommand interface {
	Name() string
	DefineFlags(*flag.FlagSet)
	// Run runs the subcommand with the given arguments and returns
	// the string to be printed and an error if any. If there is an
	// error, the string will (should) always be empty.
	Run([]string) (string, error)
}

type SubCommandFlagSet

type SubCommandFlagSet struct {
	*flag.FlagSet
	// contains filtered or unexported fields
}

func NewSubCommandFlagSet

func NewSubCommandFlagSet(cmd SubCommand) *SubCommandFlagSet

func (*SubCommandFlagSet) ParseAndRun

func (fs *SubCommandFlagSet) ParseAndRun(args []string) (string, error)

Jump to

Keyboard shortcuts

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