cmd

package
v0.0.0-...-873fb03 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const CommonsRepoURL = "https://github.com/ZupIT/ritchie-formulas"
View Source
const (
	Group = "group"
)

Variables

View Source
var (
	ErrFormulaCmdNotBeEmpty        = errors.New("this input must not be empty")
	ErrFormulaCmdMustStartWithRit  = errors.New("rit formula's command needs to start with \"rit\" [ex.: rit group verb <noun>]")
	ErrInvalidFormulaCmdSize       = errors.New("rit formula's command needs at least 2 words following \"rit\" [ex.: rit group verb]")
	ErrInvalidCharactersFormulaCmd = errors.New(`these characters are not allowed in the formula command [\ /,> <@ -]`)
	InvalidWorkspace               = "the workspace path informed doesn't exist. Do you want to create it?"
)
View Source
var (
	NoDefinedEnvsMsg    = "You have no defined envs"
	DeleteEnvSuccessMsg = "Delete env successful!"
)
View Source
var (
	ErrCouldNotFindFormula  = errors.New(msgFormulaNotFound)
	ErrIncorrectFormulaName = errors.New(msgIncorrectFormulaName)
)
View Source
var (
	FormulaLocalRunWarning    = i18n.T("init.run.type.local.warning")
	AddTheCommunityRepo       = i18n.T("init.add.commons.repo.question")
	SelectFormulaTypeQuestion = i18n.T("init.run.type.question")
	AgreeSendMetrics          = i18n.T("init.add.metric.question")

	AcceptOpt         = i18n.T("input.accept.opt")
	DeclineOpt        = i18n.T("input.decline.opt")
	LocalRunType      = i18n.T("input.run.type.local")
	DockerRunType     = i18n.T("input.run.type.docker")
	AcceptDeclineOpts = []string{AcceptOpt, DeclineOpt}
	RunTypes          = []string{LocalRunType, DockerRunType}

	ErrInitCommonsRepo = errors.New(errMsg)
	ErrInvalidRunType  = errors.New(i18n.T("init.invalid.run.type.error", strings.Join(formula.RunnerTypes, ", ")))
)
View Source
var (
	Version   = ""
	BuildDate = "unknown"
	MsgInit   = "To start using rit, you need to initialize rit first.\nCommand: rit init"
)
View Source
var ErrEmptyWorkspace = errors.New("there is no workspace to update")
View Source
var ErrEmptyWorkspaces = errors.New("there are no workspaces to delete")
View Source
var ErrRepoNameNotEmpty = errors.New("the field repository name must not be empty")
View Source
var ErrRunFormulaWithTwoFlag = errors.New("you cannot run formula with --docker and --local flags together")

Functions

func DeprecateCmd

func DeprecateCmd(parentCmd *cobra.Command, deprecatedCmd, deprecatedMsg string)

func FormulaWorkspaceInput

func FormulaWorkspaceInput(
	workspaces formula.Workspaces,
	inList prompt.InputList,
	inTextValidator prompt.InputTextValidator,
	inPath prompt.InputPath,
) (formula.Workspace, error)

func IsFlagInput

func IsFlagInput(cmd *cobra.Command) bool

func NewAddCmd

func NewAddCmd() *cobra.Command

NewAddCmd create a new add instance.

func NewAddWorkspaceCmd

func NewAddWorkspaceCmd(
	workspace formula.WorkspaceAddLister,
	input prompt.InputTextValidator,
	inPath prompt.InputPath,
) *cobra.Command

func NewAutocompleteBash

func NewAutocompleteBash(g autocomplete.Generator) *cobra.Command

NewAutocompleteBash creates a new cmd instance zsh.

func NewAutocompleteCmd

func NewAutocompleteCmd() *cobra.Command

NewAutocompleteCmd creates a new cmd instance.

func NewAutocompleteFish

func NewAutocompleteFish(g autocomplete.Generator) *cobra.Command

NewAutocompleteFish creates a new cmd instance fish.

func NewAutocompletePowerShell

func NewAutocompletePowerShell(g autocomplete.Generator) *cobra.Command

NewAutocompletePowerShell creates a new cmd instance PowerShell.

func NewAutocompleteZsh

func NewAutocompleteZsh(g autocomplete.Generator) *cobra.Command

NewAutocompleteZsh creates a new cmd instance zsh.

func NewBuildCmd

func NewBuildCmd() *cobra.Command

func NewBuildFormulaCmd

func NewBuildFormulaCmd() *cobra.Command

func NewCreateCmd

func NewCreateCmd() *cobra.Command

NewCreateCmd creates new cmd instance.

func NewCreateFormulaCmd

func NewCreateFormulaCmd(
	homeDir string,
	formula formula.CreateBuilder,
	tplM template.Manager,
	workspace formula.WorkspaceAddListHasher,
	inText prompt.InputText,
	inTextValidator prompt.InputTextValidator,
	inList prompt.InputList,
	inPath prompt.InputPath,
	rtf rtutorial.Finder,
	treeChecker formula.TreeChecker,
	validator validator.Manager,
	inputBool prompt.InputBool,
	dirMan stream.DirCreater,
) *cobra.Command

NewCreateFormulaCmd creates a new cmd instance.

func NewDeleteCmd

func NewDeleteCmd() *cobra.Command

NewDeleteCmd create a new delete instance.

func NewDeleteCredentialCmd

func NewDeleteCredentialCmd(
	credDelete credential.CredDelete,
	credReader credential.ReaderPather,
	env env.Finder,
	inBool prompt.InputBool,
	inList prompt.InputList,
) *cobra.Command

NewDeleteCredentialCmd creates a new cmd instance

func NewDeleteEnvCmd

func NewDeleteEnvCmd(
	fr env.FindRemover,
	ib prompt.InputBool,
	il prompt.InputList,
) *cobra.Command

func NewDeleteFormulaCmd

func NewDeleteFormulaCmd(
	userHomeDir string,
	ritchieHomeDir string,
	workspace formula.WorkspaceAddLister,
	directory stream.DirListChecker,
	inBool prompt.InputBool,
	inTextValidator prompt.InputTextValidator,
	inList prompt.InputList,
	inPath prompt.InputPath,
	treeGen formula.TreeGenerator,
	fileManager stream.FileWriteRemover,
) *cobra.Command

func NewDeleteWorkspaceCmd

func NewDeleteWorkspaceCmd(
	userHomeDir string,
	workspace formula.WorkspaceListDeleter,
	repo formula.RepositoryDeleter,
	inList prompt.InputList,
	inBool prompt.InputBool,
) *cobra.Command

func NewInitCmd

func NewInitCmd(
	repo formula.RepositoryAdder,
	git git.Repositories,
	tutorial rtutorial.Finder,
	config formula.ConfigRunner,
	file stream.FileWriter,
	inList prompt.InputList,
	inBool prompt.InputBool,
	metricSender metric.SendManagerHttp,
	ritConfig config.Writer,
) *cobra.Command

func NewListCmd

func NewListCmd() *cobra.Command

NewListCmd create a new list instance.

func NewListCredentialCmd

func NewListCredentialCmd(ss credential.ReaderWriterPather) *cobra.Command

func NewListRepoCmd

func NewListRepoCmd(rl formula.RepositoryLister, rtf rtutorial.Finder) *cobra.Command

func NewListWorkspaceCmd

func NewListWorkspaceCmd(wl formula.WorkspaceLister, rtf rtutorial.Finder) *cobra.Command

func NewMetricsCmd

func NewMetricsCmd(file stream.FileWriteReadExister, inList prompt.InputList) *cobra.Command

func NewRenameCmd

func NewRenameCmd() *cobra.Command

NewRenameCmd creates new cmd instance.

func NewRenameFormulaCmd

func NewRenameFormulaCmd(
	workspace formula.WorkspaceAddListHasher,
	inList prompt.InputList,
	inTextValidator prompt.InputTextValidator,
	inBool prompt.InputBool,
	directory stream.DirManager,
	validator validator.Manager,
	formula formula.CreateBuilder,
	treeGen formula.TreeGenerator,
	deleter deleter.DeleteManager,
	userHomeDir string,
	ritHomeDir string,

) *cobra.Command

New renameFormulaCmd rename a cmd instance.

func NewSetCmd

func NewSetCmd() *cobra.Command

NewSetCmd creates new cmd instance.

func NewSetCredentialCmd

func NewSetCredentialCmd(
	credSetter credential.Setter,
	credFile credential.ReaderWriterPather,
	inText prompt.InputText,
	inBool prompt.InputBool,
	inList prompt.InputList,
	inPass prompt.InputPassword,
) *cobra.Command

NewSetCredentialCmd creates a new cmd instance.

func NewSetEnvCmd

func NewSetEnvCmd(
	fs renv.FindSetter,
	it prompt.InputText,
	il prompt.InputList,
) *cobra.Command

func NewSetFormulaRunnerCmd

func NewSetFormulaRunnerCmd(c formula.ConfigRunner, i prompt.InputList) *cobra.Command

func NewSetPriorityCmd

func NewSetPriorityCmd(
	inList prompt.InputList,
	inInt prompt.InputInt,
	repoLister formula.RepositoryLister,
	repoPriority formula.RepositoryPrioritySetter,
) *cobra.Command

func NewShowCmd

func NewShowCmd() *cobra.Command

func NewShowEnvCmd

func NewShowEnvCmd(f env.Finder) *cobra.Command

func NewShowFormulaRunnerCmd

func NewShowFormulaRunnerCmd(c formula.ConfigRunner) *cobra.Command

func NewTutorialCmd

func NewTutorialCmd(il prompt.InputList, tt rtutorial.FindSetter) *cobra.Command

NewTutorialCmd creates tutorial command.

func NewUpdateCmd

func NewUpdateCmd() *cobra.Command

NewUpdateCmd create a new update instance.

func NewUpdateRepoCmd

func NewUpdateRepoCmd(
	client *http.Client,
	repo formula.RepositoryListUpdater,
	repoProviders formula.RepoProviders,
	inText prompt.InputText,
	inPass prompt.InputPassword,
	inURL prompt.InputURL,
	inList prompt.InputList,
	inBool prompt.InputBool,
	inInt prompt.InputInt,
) *cobra.Command

func NewUpdateWorkspaceCmd

func NewUpdateWorkspaceCmd(
	workspace formula.WorkspaceListUpdater,
	inList prompt.InputList,
) *cobra.Command

func WorkspaceListInput

func WorkspaceListInput(
	workspaces formula.Workspaces,
	inList prompt.InputList,
) (formula.Workspace, error)

Types

type ByCmd

type ByCmd []formulaDefinition

func (ByCmd) Len

func (a ByCmd) Len() int

func (ByCmd) Less

func (a ByCmd) Less(i, j int) bool

func (ByCmd) Swap

func (a ByCmd) Swap(i, j int)

type CommandRunnerFunc

type CommandRunnerFunc func(cmd *cobra.Command, args []string) error

CommandRunnerFunc represents that runner func for commands.

func RunFuncE

func RunFuncE(stdinFunc, promptFunc CommandRunnerFunc) CommandRunnerFunc

RunFuncE delegates to stdinFunc if --stdin flag is passed otherwise delegates to promptFunc.

type FormulaCommand

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

func NewFormulaCommand

func NewFormulaCommand(
	coreCmds api.Commands,
	treeManager formula.TreeManager,
	formula formula.Executor,
	file stream.FileReader,
) *FormulaCommand

func (FormulaCommand) Add

func (f FormulaCommand) Add(root *cobra.Command) error

type UpgradeCmd

type UpgradeCmd struct {
	upgrade.Manager

	upgrade.UrlFinder
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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