modes

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2015 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package modes contains all subcommands (called "modes").

MCPM starts mode by its name given in a command line.

To create a mode. Create new Go source file in this package directory and follow that example:

func anyname(mo *ModeOptions) {
    // Do something there
}
func init() {
    registerMode("command-name", anyname);
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LaunchMode

func LaunchMode(m string)

LaunchMode finds mode by its name and run this with set mode options. If mode is not found, LaunchMode shows usage of command.

Types

type Mode

type Mode struct {
	Func      func(*Mode, *ModeOptions)
	Usage     string
	RunBefore *Mode
	RunAfter  *Mode
}

Mode contains functions needed in specific order. (EXPERIMENTAL)

func (*Mode) CanRun

func (m *Mode) CanRun() bool

func (*Mode) Run

func (m *Mode) Run(mo *ModeOptions)

type ModeList

type ModeList map[string]func(*ModeOptions)

ModeList contains modes associated with unique name.

type ModeOptions

type ModeOptions struct {
	ModeName     string
	Verbose      bool
	DownloadOnly bool
	VersionQuery string
	Args         []string
}

ModeOptions contains all flags and arguments set in a command.

Jump to

Keyboard shortcuts

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