Documentation ¶
Index ¶
- Constants
- func Clean(category string) error
- func Copy(src, dest string) error
- func CreateIfNotExist(file string) (*os.File, error)
- func CreateTemplate(category, name, content string) error
- func FileExists(file string) bool
- func FileNameWithoutExt(file string) string
- func FindGoModPath(dir string) (string, bool)
- func FindProjectPath(loc string) (string, bool)
- func GetAutoCompleteHome() (string, error)
- func GetCacheDir() (string, error)
- func GetDefaultGoctlHome() (string, error)
- func GetGitHome() (string, error)
- func GetGoctlHome() (home string, err error)
- func GetTemplateDir(category string) (string, error)
- func Hash(file string) (string, error)
- func InitTemplates(category string, templates map[string]string) error
- func JoinPackages(pkgs ...string) string
- func LoadTemplate(category, file, builtin string) (string, error)
- func MkdirIfNotExist(dir string) error
- func MustTempDir() string
- func PathFromGoSrc() (string, error)
- func ReadLink(name string) (string, error)
- func RegisterGoctlHome(home string)
- func RemoveIfExist(filename string) error
- func RemoveOrQuit(filename string) error
- func SameFile(path1, path2 string) (bool, error)
Constants ¶
const (
NL = "\n"
)
NL defines a new line.
Variables ¶
This section is empty.
Functions ¶
func CreateIfNotExist ¶
CreateIfNotExist creates a file if it is not exists.
func CreateTemplate ¶
CreateTemplate writes template into file even it is exists.
func FileExists ¶
FileExists returns true if the specified file is exists.
func FileNameWithoutExt ¶
FileNameWithoutExt returns a file name without suffix.
func FindGoModPath ¶
FindGoModPath returns the path in project where has file go.mod, it returns empty string if there is no go.mod file in project.
func FindProjectPath ¶
FindProjectPath returns the parent directory where has file go.mod in project
func GetAutoCompleteHome ¶
GetAutoCompleteHome returns the auto_complete home of goctlwt.
func GetDefaultGoctlHome ¶
GetDefaultGoctlHome returns the path value of the goctlwt home where Join $HOME with .goctlwt.
func GetGoctlHome ¶
GetGoctlHome returns the path value of the goctlwt, the default path is ~/.goctlwt, if the path has been set by calling the RegisterGoctlHome method, the user-defined path refers to.
func GetTemplateDir ¶
GetTemplateDir returns the category path value in GoctlHome where could get it by GetGoctlHome.
func InitTemplates ¶
InitTemplates creates template files GoctlHome where could get it by GetGoctlHome.
func JoinPackages ¶
JoinPackages calls strings.Join and returns
func LoadTemplate ¶
LoadTemplate gets template content by the specified file.
func MkdirIfNotExist ¶
MkdirIfNotExist makes directories if the input path is not exists
func PathFromGoSrc ¶
PathFromGoSrc returns the path without slash where has been trim the prefix $GOPATH
func RegisterGoctlHome ¶
func RegisterGoctlHome(home string)
RegisterGoctlHome register goctlwt home path.
func RemoveIfExist ¶
RemoveIfExist deletes the specified file if it is exists.
func RemoveOrQuit ¶
RemoveOrQuit deletes the specified file if read a permit command from stdin.
Types ¶
This section is empty.