cli

package
v0.0.0-...-7fc9597 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package cli provides a CLI UI for the gorram command line tool.

Index

Constants

View Source
const CacheEnv = "GORRAM_CACHE"

CacheEnv is the environment variable that users may set to change the location where gorram stores its script files.

Variables

This section is empty.

Functions

func ParseAndRun

func ParseAndRun(env OSEnv) int

ParseAndRun parses the environment to create a run.Command and runs it. It returns the code that should be used for os.Exit.

func Run

func Run() int

Run parses the gorram command line args and runs the gorram command.

Types

type OSEnv

type OSEnv struct {
	Args   []string
	Stderr io.Writer
	Stdout io.Writer
	Stdin  io.Reader
	Env    map[string]string
}

OSEnv encapsulates the gorram environment.

type UI

type UI struct {
	Regen    bool
	Template string
	Cache    string
	Args     []string
}

UI represents the UI of the CLI, including flags and actions.

func Parse

func Parse(env OSEnv) (*UI, error)

Parse converts the gorram command line. If an error is returned, the program should exit with the code specified by the error's Code() int function.

Jump to

Keyboard shortcuts

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