feat: Add --remote (#1387)

Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
anqiansong
2021-12-29 18:16:42 +08:00
committed by GitHub
parent 23deaf50e6
commit b8ea16a88e
12 changed files with 265 additions and 31 deletions

View File

@@ -17,6 +17,7 @@ import (
const (
NL = "\n"
goctlDir = ".goctl"
gitDir = ".git"
)
var goctlHome string
@@ -82,6 +83,16 @@ func GetGoctlHome() (string, error) {
return filepath.Join(home, goctlDir), nil
}
// GetGitHome returns the git home of goctl.
func GetGitHome() (string, error) {
goctlH, err := GetGoctlHome()
if err != nil {
return "", err
}
return filepath.Join(goctlH, gitDir), nil
}
// GetTemplateDir returns the category path value in GoctlHome where could get it by GetGoctlHome
func GetTemplateDir(category string) (string, error) {
goctlHome, err := GetGoctlHome()