Documentation
¶
Index ¶
- Constants
- Variables
- func Black(msg string) string
- func Blue(msg string) string
- func CommitAndPushGithubRepo(directory, branch, path, accessToken string, auth *http.BasicAuth) error
- func CopyDir(srcPath string, destPath string) error
- func CreateGithubRepo(organization, name, description, token string, private bool) (*github.Repository, error)
- func Cyan(msg string) string
- func FetchEKSKubeconfig(ctx context.Context, svc *eks.Client, region, clusterName string) (*clientcmdapi.Config, error)
- func FileCopy(src, dst string) (int64, error)
- func FileCreate(content bytes.Buffer, name string) error
- func FileMonitoringById(ctx context.Context, filePth string, id string, group string, ...)
- func FileOpen(content bytes.Buffer, name string, mode os.FileMode) error
- func Generate(c *TemplateConfig) (err error)
- func GetAppPath() string
- func GetCurrentPath() string
- func GetFileSize(filename string) int64
- func GetGithubRepoAllBranches(ctx context.Context, organization, name, token string) ([]*github.Branch, error)
- func GetInstallPath() string
- func GetLatestVersion() string
- func GetOrganizationsFromGithub(ctx context.Context, conf *oauth2.Config, accessToken string) ([]string, error)
- func GetParseFromTemplate(dir, subPath string) (map[string]string, error)
- func GetSubPath(directory string) ([]string, error)
- func GetTmpPath() string
- func GistClone(id, dir, accessToken string) error
- func GitClone(url, branch, directory string, noCheckout bool, accessToken string) (*git.Repository, error)
- func GitCloneSSH(url, directory, reference, privateKeyFile, password string) error
- func GitRemote(url, directory string) error
- func Green(msg string) string
- func InArray(vals []string, array []string, replace string, n int) bool
- func IsWindows() bool
- func Magenta(msg string) string
- func NowEndDay() time.Time
- func NowFormatDay() string
- func NowFormatHour() string
- func NowFormatMinute() string
- func NowFormatMonth() string
- func NowFormatSecond() string
- func NowFormatYear() string
- func NowStartDay() time.Time
- func PathCreate(dir string) error
- func PathExist(addr string) bool
- func Pluralize(word string) string
- func Red(msg string) string
- func SetColor(msg string, conf, bg, text int) string
- func SimpleID() string
- func TimeEndDay(t time.Time) time.Time
- func TimeFormatDay(t time.Time) string
- func TimeFormatHour(t time.Time) string
- func TimeFormatMinute(t time.Time) string
- func TimeFormatMonth(t time.Time) string
- func TimeFormatSecond(t time.Time) string
- func TimeFormatYear(t time.Time) string
- func TimeStartDay(t time.Time) time.Time
- func White(msg string) string
- func Yellow(msg string) string
- type AccessType
- type BaseRule
- type Generator
- type GithubConfig
- type GithubOrganization
- type GithubUser
- type LoginProvider
- type ReplaceHelper
- type RuleType
- type Task
- type TemplateConfig
- type TreeImp
Constants ¶
View Source
const ( TextBlack = iota + 30 TextRed TextGreen TextYellow TextBlue TextMagenta TextCyan TextWhite )
Variables ¶
View Source
var TemplateIgnore = ".templateignore"
View Source
var TemplateParseIgnore = ".templateparseignore"
View Source
var Version string
Version is the version of the binary
Functions ¶
func CommitAndPushGithubRepo ¶
func CommitAndPushGithubRepo(directory, branch, path, accessToken string, auth *http.BasicAuth) error
CommitAndPushGithubRepo commit and push github repo
func CreateGithubRepo ¶
func CreateGithubRepo(organization, name, description, token string, private bool) (*github.Repository, error)
CreateGithubRepo create github repo
func FetchEKSKubeconfig ¶ added in v0.4.6
func FetchEKSKubeconfig(ctx context.Context, svc *eks.Client, region, clusterName string) (*clientcmdapi.Config, error)
FetchEKSKubeconfig fetches the kubeconfig for the specified EKS cluster.
func FileMonitoringById ¶
func Generate ¶
func Generate(c *TemplateConfig) (err error)
Generate example
func Generate(url, destinationPath string, cfg interface{}, githubConfig *GithubConfig, accessToken string) error {
templatePath := filepath.Base(url)
func GetAppPath ¶
func GetAppPath() string
GetAppPath Get the absolute path to the running directory
func GetGithubRepoAllBranches ¶
func GetGithubRepoAllBranches(ctx context.Context, organization, name, token string) ([]*github.Branch, error)
GetGithubRepoAllBranches get all branches of github repo
func GetInstallPath ¶
func GetInstallPath() string
GetInstallPath Different systems get different installation paths
func GetParseFromTemplate ¶
GetParseFromTemplate get parse keys from template
func GetSubPath ¶
GetSubPath get directory's subject path
func GitClone ¶
func GitClone(url, branch, directory string, noCheckout bool, accessToken string) (*git.Repository, error)
GitClone clone git repo
func GitCloneSSH ¶
GitCloneSSH clone git repo from ssh
func IsWindows ¶
func IsWindows() bool
IsWindows Determine whether the current system is a Windows system?
func NowFormatDay ¶
func NowFormatDay() string
func NowFormatHour ¶
func NowFormatHour() string
func NowFormatMinute ¶
func NowFormatMinute() string
func NowFormatMonth ¶
func NowFormatMonth() string
func NowFormatSecond ¶
func NowFormatSecond() string
func NowFormatYear ¶
func NowFormatYear() string
func NowStartDay ¶
func TimeFormatDay ¶
func TimeFormatHour ¶
func TimeFormatMinute ¶
func TimeFormatMonth ¶
func TimeFormatSecond ¶
func TimeFormatYear ¶
Types ¶
type AccessType ¶
type AccessType string
const ( // DirectoryAccessType 目录类型 DirectoryAccessType AccessType = "DIRECTORY" // MenuAccessType 菜单类型 MenuAccessType AccessType = "MENU" // APIAccessType API类型 APIAccessType AccessType = "API" // ComponentAccessType 组件类型 ComponentAccessType AccessType = "COMPONENT" )
func (AccessType) String ¶
func (a AccessType) String() string
type BaseRule ¶
type BaseRule struct {
ID string `json:"id"`
WarningOnly bool `json:"warningOnly,omitempty"`
Len uint8 `json:"len,omitempty"`
Max uint8 `json:"max,omitempty"`
Min uint8 `json:"min,omitempty"`
Message string `json:"message,omitempty"`
Pattern string `json:"pattern,omitempty"`
Required bool `json:"required,omitempty"`
Type RuleType `json:"type,omitempty"`
Whitespace bool `json:"whitespace,omitempty"`
ValidateTrigger string `json:"validateTrigger,omitempty"`
}
type Generator ¶
type Generator struct {
SubPath string
TemplatePath string
DestinationPath string
Cfg interface{}
TemplateIgnoreDirs []string
TemplateIgnoreFiles []string
TemplateParseIgnoreDirs []string
TemplateParseIgnoreFiles []string
}
Generator generate operator
type GithubConfig ¶
type GithubOrganization ¶
type GithubOrganization struct {
Login string `json:"login"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
URL string `json:"url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
HooksURL string `json:"hooks_url"`
IssuesURL string `json:"issues_url"`
MembersURL string `json:"members_url"`
PublicMembersURL string `json:"public_members_url"`
AvatarURL string `json:"avatar_url"`
Description string `json:"description"`
}
type GithubUser ¶
type GithubUser struct {
Login string `json:"login"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
AvatarURL string `json:"avatar_url"`
GravatarID string `json:"gravatar_id"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
FollowersURL string `json:"followers_url"`
FollowingURL string `json:"following_url"`
GistsURL string `json:"gists_url"`
StarredURL string `json:"starred_url"`
SubscriptionsURL string `json:"subscriptions_url"`
OrganizationsURL string `json:"organizations_url"`
ReposURL string `json:"repos_url"`
EventsURL string `json:"events_url"`
ReceivedEventsURL string `json:"received_events_url"`
Type string `json:"type"`
SiteAdmin bool `json:"site_admin"`
Name string `json:"name"`
Company string `json:"company"`
Blog string `json:"blog"`
Location string `json:"location"`
Email string `json:"email"`
Hireable bool `json:"hireable"`
Bio string `json:"bio"`
TwitterUsername string `json:"twitter_username"`
PublicRepos int64 `json:"public_repos"`
PublicGists int64 `json:"public_gists"`
Followers int64 `json:"followers"`
Following int64 `json:"following"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
PrivateGists int64 `json:"private_gists"`
TotalPrivateRepos int64 `json:"total_private_repos"`
OwnedPrivateRepos int64 `json:"owned_private_repos"`
DiskUsage int64 `json:"disk_usage"`
Collaborators int64 `json:"collaborators"`
TwoFactorAuth bool `json:"two_factor_authentication"`
Plan struct {
Name string `json:"name"`
Space int64 `json:"space"`
Collaborators int64 `json:"collaborators"`
PrivateRepos int64 `json:"private_repos"`
} `json:"plan"`
}
func GetUserFromGithub ¶
type LoginProvider ¶ added in v0.4.6
type LoginProvider string
const ( // GithubLoginProvider github oauth provider GithubLoginProvider LoginProvider = "github" // LarkLoginProvider lark oauth provider LarkLoginProvider LoginProvider = "lark" // EmailLoginProvider email login provider EmailLoginProvider LoginProvider = "email" )
func (LoginProvider) String ¶ added in v0.4.6
func (o LoginProvider) String() string
type ReplaceHelper ¶
type ReplaceHelper struct {
// Root path
Root string
// OldText need to replace text
OldText string
// NewText new text
NewText string
}
func (*ReplaceHelper) DoWork ¶
func (h *ReplaceHelper) DoWork() error
type RuleType ¶
type RuleType string
const ( RUleTypeString RuleType = "string" RUleTypeNumber RuleType = "number" RUleTypeBool RuleType = "boolean" RUleTypeMethod RuleType = "method" RUleTypeRegexp RuleType = "regexp" RUleTypeInt RuleType = "integer" RUleTypeFloat RuleType = "float" RUleTypeObject RuleType = "object" RUleTypeEnum RuleType = "enum" RUleTypeDate RuleType = "date" RUleTypeUrl RuleType = "url" RUleTypeHex RuleType = "hex" RUleTypeEmail RuleType = "email" )
type Task ¶
type TemplateConfig ¶
type TemplateConfig struct {
Service string `yaml:"service"`
TemplateUrl string `yaml:"templateUrl"`
TemplateLocal string `yaml:"templateLocal"`
TemplateLocalSubPath string `yaml:"templateLocalSubPath"`
CreateRepo bool `yaml:"createRepo"`
Destination string `yaml:"destination"`
Github *GithubConfig `yaml:"github"`
Params interface{} `yaml:"params"`
Ignore []string `yaml:"ignore"`
}
func (*TemplateConfig) OnChange ¶
func (e *TemplateConfig) OnChange()
Source Files
¶
Click to show internal directories.
Click to hide internal directories.