commands

package
v0.0.0-...-2839ab5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Absorb = Command{"absorb", "Merge the changes in another branch into this one", execAbsorb, printAbsorbHelp}
View Source
var Commit = Command{"commit", "Make a commit", execCommit, printCommitHelp}
View Source
var Delete = Command{"delete", "Deletes a commit or branch", execDelete, printDeleteHelp}
View Source
var Init = Command{"create", "Create a repo", execCreate, printCreateHelp}
View Source
var Line = Command{"line", "Create a new line", execLine, printLineHelp}
View Source
var Patch = Command{"patch", "Will patch the last commit with the current work", execPatch, printPatchHelp}
View Source
var Resolve = Command{"resolve", "Commit resolved conflicts after absorb", execResolve, printResolveHelp}
View Source
var Status = Command{"status", "Show the state of the repo", execStatus, printStatusHelp}
View Source
var Switch = Command{"switch", "Switch to a different line", execSwitch, printSwitchHelp}
View Source
var Sync = Command{"sync", "Sync with remote repo or something like that", execSync, printSyncHelp}
View Source
var Template = Command{"template", "Show you how a command should look", execTemplate, printTemplateHelp}

Functions

func ParseArgs

func ParseArgs(args []string, allOptions []Option) ([]string, map[string]string, bool, error)

Parse the arguments given to Metro on the command line. args: The arguments to parse. allOptions: The list of possible options.

All positional arguments must come before all Option arguments. Options may have a value associated with them, in the form "--key=value" or "--key value". Each Option has a long version, prefixed with --, and a short version, prefixed with -. Using the wrong prefix will result in the Option not being recognised. The --help and -h flags are excluded from the options; instead hashHelpFlag is set. The Name of the executable is excluded from the returned arguments.

Returns: positionals, options, hasHelpFlag, error options maps the long Name of each Option to its value, even if a Contraction is used. Prefix -'s are excluded.

Will return an error if: - An unknown Option is given - An Option that requires a value isn't given one - An Option that doesn't require a value is given one - A positional argument is found after an Option (interpreted as a value with no corresponding Option flag)

Types

type Command

type Command struct {
	Name        string
	Description string
	Execute     func(*git.Repository, []string, map[string]string) error
	Help        func([]string, map[string]string)
}

type Option

type Option struct {
	Name        string
	Contraction string
	NeedsValue  bool
}

An Option on the command line. Name: The long form Name of the Option, e.g. --help Contraction: The short Name of the Option, e.g. -h NeedsValue: Whether this Option needs and allows a value associated with it

Jump to

Keyboard shortcuts

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