feature: Add goctl completion (#1505)
* feature: Add `goctl completion` * Update const Co-authored-by: anqiansong <anqiansong@bytedance.com>
This commit is contained in:
@@ -15,9 +15,10 @@ import (
|
||||
|
||||
// NL defines a new line
|
||||
const (
|
||||
NL = "\n"
|
||||
goctlDir = ".goctl"
|
||||
gitDir = ".git"
|
||||
NL = "\n"
|
||||
goctlDir = ".goctl"
|
||||
gitDir = ".git"
|
||||
autoCompleteDir = ".auto_complete"
|
||||
)
|
||||
|
||||
var goctlHome string
|
||||
@@ -93,6 +94,16 @@ func GetGitHome() (string, error) {
|
||||
return filepath.Join(goctlH, gitDir), nil
|
||||
}
|
||||
|
||||
// GetAutoCompleteHome returns the auto_complete home of goctl.
|
||||
func GetAutoCompleteHome() (string, error) {
|
||||
goctlH, err := GetGoctlHome()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return filepath.Join(goctlH, autoCompleteDir), nil
|
||||
}
|
||||
|
||||
// GetTemplateDir returns the category path value in GoctlHome where could get it by GetGoctlHome
|
||||
func GetTemplateDir(category string) (string, error) {
|
||||
home, err := GetGoctlHome()
|
||||
|
||||
Reference in New Issue
Block a user