cli

package
v0.0.2-dev Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2016 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package cli implements command line commands.

Index

Constants

View Source
const (
	// CLIOwner is the owner of the CLI's Github repository.
	CLIOwner = "stratumn"

	// CLIRepo is the name of the CLI's Github repository.
	CLIRepo = "go"

	// CLIAssetFormat is the format of the CLI GIthub asset.
	CLIAssetFormat = "strat-%s-%s.zip"

	// CLIAssetBinary is the file name of the binary within the CLI asset.
	CLIAssetBinary = "strat/strat"

	// CLIAssetBinaryWin is the file name of the binary within the CLI asset
	// on Windows.
	CLIAssetBinaryWin = "strat/strat.exe"

	// CLIOldBinary is the name of the old binary after an update.
	CLIOldBinary = ".strat.old"

	// CLISigExt the extension of the signature of the binary.
	CLISigExt = ".sig"

	// DefaultGeneratorsOwner is the default owner of the generators' Github
	// repository.
	DefaultGeneratorsOwner = "stratumn"

	// DefaultGeneratorsRepo is the default name of the generators' Github
	// repository.
	DefaultGeneratorsRepo = "generators"

	// DefaultGeneratorsRef is the default reference of the generators'
	// Github repository.
	DefaultGeneratorsRef = "master"

	// StratumnConfigEnv is the name of the environment variable to override
	// the default configuration path.
	StratumnConfigEnv = "STRATUMN_CONFIG"

	// DefaultStratumnDir is the name of the Stratumn directory within the
	// home folder.
	DefaultStratumnDir = ".stratumn"

	// GeneratorsDir is the name of the generators directory within the
	// configuration directory.
	GeneratorsDir = "generators"

	// VarsFile is the name of the variable file within the configuration directory.
	VarsFile = "variables.json"

	// ProjectFile is the name of the project file within the project
	// directory.
	ProjectFile = "stratumn.json"

	// InitScript is the name of the project init script.
	InitScript = "init"

	// UpScript is the name of the project up script.
	UpScript = "up"

	// DownScript is the name of the project down script.
	DownScript = "down"

	// BuildScript is the name of the project build script.
	BuildScript = "build"

	// TestScript is the name of the project test script.
	TestScript = "test"

	// PullScript is the name of the project pull script.
	PullScript = "pull"

	// PushScript is the name of the project push script.
	PushScript = "push"

	// DeployScriptFmt is the format of the name of the project deploy
	// script for an environment.
	DeployScriptFmt = "deploy:%s"

	// DownTestScript is the name of the project down script for test.
	DownTestScript = "down:test"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Build

type Build struct {
}

Build is a project command that builds the project.

func (*Build) Execute

func (cmd *Build) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Build) Name

func (*Build) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Build) SetFlags

func (*Build) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Build) Synopsis

func (*Build) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Build) Usage

func (*Build) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Deploy

type Deploy struct {
}

Deploy is a project command that deploys a project to an environment.

func (*Deploy) Execute

func (cmd *Deploy) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Deploy) Name

func (*Deploy) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Deploy) SetFlags

func (*Deploy) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Deploy) Synopsis

func (*Deploy) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Deploy) Usage

func (*Deploy) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Down

type Down struct {
}

Down is a project command that stops the services.

func (*Down) Execute

func (cmd *Down) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Down) Name

func (*Down) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Down) SetFlags

func (*Down) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Down) Synopsis

func (*Down) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Down) Usage

func (*Down) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Generate

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

Generate is a generator command that generates a project.

func (*Generate) Execute

func (cmd *Generate) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Generate) Name

func (*Generate) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Generate) SetFlags

func (cmd *Generate) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Generate) Synopsis

func (*Generate) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Generate) Usage

func (*Generate) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Generators

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

Generators is a generator command that lists generators.

func (*Generators) Execute

func (cmd *Generators) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Generators) Name

func (*Generators) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Generators) SetFlags

func (cmd *Generators) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Generators) Synopsis

func (*Generators) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Generators) Usage

func (*Generators) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Info

type Info struct {
	Version string
	Commit  string
}

Info is a CLI command that prints info about the program.

func (*Info) Execute

func (cmd *Info) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Info) Name

func (*Info) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Info) SetFlags

func (*Info) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Info) Synopsis

func (*Info) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Info) Usage

func (*Info) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Project

type Project struct {
	Scripts map[string]string `json:"scripts"`
}

Project describes a project.

func NewProjectFromFile

func NewProjectFromFile(path string) (*Project, error)

NewProjectFromFile instantiates a project from a project file.

func (*Project) GetScript

func (prj *Project) GetScript(name string) string

GetScript returns a script by name. If the script is undefined, it returns an empty string.

type Pull

type Pull struct {
}

Pull is a project command that pulls updates.

func (*Pull) Execute

func (cmd *Pull) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Pull) Name

func (*Pull) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Pull) SetFlags

func (*Pull) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Pull) Synopsis

func (*Pull) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Pull) Usage

func (*Pull) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Push

type Push struct {
}

Push is a project command that pushes updates.

func (*Push) Execute

func (cmd *Push) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Push) Name

func (*Push) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Push) SetFlags

func (*Push) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Push) Synopsis

func (*Push) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Push) Usage

func (*Push) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Run

type Run struct {
}

Run is a project command that runs script by name.

func (*Run) Execute

func (cmd *Run) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Run) Name

func (*Run) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Run) SetFlags

func (*Run) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Run) Synopsis

func (*Run) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Run) Usage

func (*Run) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Test

type Test struct {
}

Test is a project command that runs tests.

func (*Test) Execute

func (cmd *Test) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Test) Name

func (*Test) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Test) SetFlags

func (*Test) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Test) Synopsis

func (*Test) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Test) Usage

func (*Test) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Up

type Up struct {
}

Up is a project command that starts the services.

func (*Up) Execute

func (cmd *Up) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Up) Name

func (*Up) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Up) SetFlags

func (*Up) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Up) Synopsis

func (*Up) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Up) Usage

func (*Up) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Update

type Update struct {
	Version string
	// contains filtered or unexported fields
}

Update is a CLI command that updates the CLI or generators.

func (*Update) Execute

func (cmd *Update) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Update) Name

func (*Update) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Update) SetFlags

func (cmd *Update) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Update) Synopsis

func (*Update) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Update) Usage

func (*Update) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

type Version

type Version struct {
	Version string
	Commit  string
}

Version is a CLI command that prints the version.

func (*Version) Execute

func (cmd *Version) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus

Execute implements github.com/google/subcommands.Command.Execute().

func (*Version) Name

func (*Version) Name() string

Name implements github.com/google/subcommands.Command.Name().

func (*Version) SetFlags

func (*Version) SetFlags(f *flag.FlagSet)

SetFlags implements github.com/google/subcommands.Command.SetFlags().

func (*Version) Synopsis

func (*Version) Synopsis() string

Synopsis implements github.com/google/subcommands.Command.Synopsis().

func (*Version) Usage

func (*Version) Usage() string

Usage implements github.com/google/subcommands.Command.Usage().

Jump to

Keyboard shortcuts

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