Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AddSubCmd = models.Command{ Name: "add", ShortHelp: "Add the git remote for the given code service to the local git repo", LongHelp: "<code>git-remote add</code> adds the proper git remote to a local git repository with the given remote name and service. " + "Here is a sample command\n\n" + "<pre>\ndatica -E \"<your_env_name>\" git-remote add code-1 -r datica-code-1\n</pre>", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(subCmd *cli.Cmd) { serviceName := subCmd.StringArg("SERVICE_NAME", "", "The name of the service to add a git remote for") remote := subCmd.StringOpt("r remote", "datica", "The name of the git remote to be added") force := subCmd.BoolOpt("f force", false, "If a git remote with the specified name already exists, overwrite it") subCmd.Action = func() { if _, err := auth.New(settings, prompts.New()).Signin(); err != nil { logrus.Fatal(err.Error()) } if err := config.CheckRequiredAssociation(settings); err != nil { logrus.Fatal(err.Error()) } err := CmdAdd(*serviceName, *remote, *force, New(), services.New(settings)) if err != nil { logrus.Fatalln(err.Error()) } } subCmd.Spec = "SERVICE_NAME [-r] [-f]" } }, }
View Source
var Cmd = models.Command{ Name: "git-remote", ShortHelp: "Manage git remotes to Datica code services", LongHelp: "The <code>git-remote</code> command allows you to interact with code service remote git URLs. " + "The git-remote command can not be run directly but has subcommands.", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(cmd *cli.Cmd) { cmd.CommandLong(AddSubCmd.Name, AddSubCmd.ShortHelp, AddSubCmd.LongHelp, AddSubCmd.CmdFunc(settings)) cmd.CommandLong(ShowSubCmd.Name, ShowSubCmd.ShortHelp, ShowSubCmd.LongHelp, ShowSubCmd.CmdFunc(settings)) } }, }
Cmd is the contract between the user and the CLI. This specifies the command name, arguments, and required/optional arguments and flags for the command.
View Source
var ShowSubCmd = models.Command{ Name: "show", ShortHelp: "Print out the git remote for a given code service", LongHelp: "<code>git-remote show</code> prints out the git remote URL for the given service. " + "This can be used to do a manual push or use the git remote for another purpose such as a CI integration. " + "Here is a sample command\n\n" + "<pre>\ndatica -E \"<your_env_name>\" git-remote show code-1\n</pre>", CmdFunc: func(settings *models.Settings) func(cmd *cli.Cmd) { return func(subCmd *cli.Cmd) { serviceName := subCmd.StringArg("SERVICE_NAME", "", "The name of the service to add a git remote for") subCmd.Action = func() { if _, err := auth.New(settings, prompts.New()).Signin(); err != nil { logrus.Fatal(err.Error()) } if err := config.CheckRequiredAssociation(settings); err != nil { logrus.Fatal(err.Error()) } err := CmdShow(*serviceName, services.New(settings)) if err != nil { logrus.Fatalln(err.Error()) } } subCmd.Spec = "SERVICE_NAME" } }, }
Functions ¶
Types ¶
type IGit ¶
type IGit interface { Add(remote, gitURL string) error Create() error Exists() bool List() ([]string, error) Rm(remote string) error SetURL(remote, gitURL string) error }
IGit is an interface through which you can perform git operations
type SGit ¶
type SGit struct{}
SGit is an implementor of IGit
func (*SGit) Add ¶
Add a git remote to a git repo in the current working directory. If the current working directory is not yet a git repo, this command will fail.
func (*SGit) Exists ¶
Exists tells you whether or not a git repo exists in the current working directory.
Click to show internal directories.
Click to hide internal directories.