cmd

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package cmd implements command line commands for strat.

Index

Constants

View Source
const (
	// EnvPrefix is the prefix of environment variables to set flag values.
	EnvPrefix = "stratumn"

	// Owner is the owner of the CLI's Github repository.
	Owner = "stratumn"

	// Repo is the name of the CLI's Github repository.
	Repo = "sdk"

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

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

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

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

	// SigExt the extension of the signature of the binary.
	SigExt = ".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"

	// 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"
)

Variables

View Source
var (
	// DefaultGeneratorsRef is the default reference of the generators'
	// Github repository. It is a variable because it is overridden at
	// compile time.
	DefaultGeneratorsRef = "master"
)
View Source
var RootCmd = &cobra.Command{
	Use:   "strat",
	Short: "Stratumn CLI",
	Long:  `The Stratumn CLI provides various commands to generate and work with Stratumn's technology.`,
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute(ver, com string)

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

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.

Jump to

Keyboard shortcuts

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