Documentation
¶
Index ¶
- Variables
- func SetBranchPrefix(feature, hotfix, conflictResolve, issue string)
- func SetBranchSetting(master, dev, test BranchTyp)
- type BranchSetting
- type BranchTyp
- type Config
- type ConfigHolder
- type ConfigType
- type FlowContext
- func (c *FlowContext) APIEndpoint() string
- func (c *FlowContext) CWD() string
- func (c *FlowContext) Config() *Config
- func (c *FlowContext) ForceRemote() bool
- func (c *FlowContext) GetOAuth() *OAuth
- func (c *FlowContext) InjectProject(p *ProjectBasics)
- func (c *FlowContext) IsDebug() bool
- func (c *FlowContext) Project() *ProjectBasics
- func (c *FlowContext) ProjectName() string
- func (c *FlowContext) ShouldOpenBrowser() bool
- type OAuth
- type OAuth2Mode
- type OpFeatureContext
- type OpHotfixContext
- type ProjectBasics
- type ProjectConfig
Constants ¶
This section is empty.
Variables ¶
var ( FeatureBranchPrefix = "feature/" HotfixBranchPrefix = "hotfix/" ConflictResolveBranchPrefix = "conflict-resolve/" IssueBranchPrefix = "issue/" )
Functions ¶
func SetBranchPrefix ¶ added in v1.8.0
func SetBranchPrefix(feature, hotfix, conflictResolve, issue string)
func SetBranchSetting ¶ added in v1.8.0
func SetBranchSetting(master, dev, test BranchTyp)
SetBranchSetting reset builtin branch enums manually.
Types ¶
type BranchSetting ¶ added in v1.7.0
type BranchSetting struct {
Master, Dev, Test BranchTyp
FeatureBranchPrefix string `toml:"feature_branch_prefix"`
HotfixBranchPrefix string `toml:"hotfix_branch_prefix"`
ConflictResolveBranchPrefix string `toml:"conflict_resolve_branch_prefix"`
IssueBranchPrefix string `toml:"issue_branch_prefix"`
}
BranchSetting contains some personal setting of git branch.
type BranchTyp ¶
type BranchTyp string
BranchTyp is builtin branch type to limit parameter passing
type Config ¶
type Config struct {
OAuth2 *OAuth `toml:"oauth"`
Branch *BranchSetting `toml:"branch"`
GitlabAPIURL string `toml:"gitlab_api_url"`
GitlabHost string `toml:"gitlab_host"`
DebugMode bool `toml:"debug"`
OpenBrowser bool `toml:"open_browser"`
}
Config contains all fields can be specified by user.
func (*Config) AsProject ¶ added in v1.9.3
func (c *Config) AsProject() *ProjectConfig
func (*Config) Type ¶ added in v1.9.3
func (c *Config) Type() ConfigType
func (*Config) ValidateConfig ¶ added in v1.9.3
type ConfigHolder ¶ added in v1.9.3
type ConfigHolder interface {
Type() ConfigType
AsGlobal() *Config
AsProject() *ProjectConfig
ValidateConfig() error
}
type ConfigType ¶ added in v1.9.3
type ConfigType string
const ( ConfigType_Global ConfigType = "global" ConfigType_Project ConfigType = "project" )
type FlowContext ¶
type FlowContext struct {
// contains filtered or unexported fields
}
FlowContext contains all necessary parameters of flow command to execute. SHOULD NOT export context attributes to another package.
func NewContext ¶
func NewContext(cwd, projectName string, c *Config, forceRemote bool) *FlowContext
NewContext be generated with non-project information. Do not use Project directly!!!
func (*FlowContext) APIEndpoint ¶ added in v1.7.0
func (c *FlowContext) APIEndpoint() string
func (*FlowContext) CWD ¶
func (c *FlowContext) CWD() string
func (*FlowContext) Config ¶ added in v1.9.1
func (c *FlowContext) Config() *Config
func (*FlowContext) ForceRemote ¶ added in v1.6.2
func (c *FlowContext) ForceRemote() bool
ForceRemote return should module need to locate project by projectName from remote. true means locate project from remote, false means do not jump the process of locating project from local.
func (*FlowContext) GetOAuth ¶ added in v1.7.0
func (c *FlowContext) GetOAuth() *OAuth
func (*FlowContext) InjectProject ¶ added in v1.7.0
func (c *FlowContext) InjectProject(p *ProjectBasics)
func (*FlowContext) IsDebug ¶ added in v1.7.0
func (c *FlowContext) IsDebug() bool
func (*FlowContext) Project ¶
func (c *FlowContext) Project() *ProjectBasics
func (*FlowContext) ProjectName ¶ added in v1.6.0
func (c *FlowContext) ProjectName() string
ProjectName return project name.
func (*FlowContext) ShouldOpenBrowser ¶ added in v1.7.0
func (c *FlowContext) ShouldOpenBrowser() bool
type OAuth ¶ added in v1.7.0
type OAuth struct {
Scopes string `toml:"scopes"`
CallbackHost string `toml:"callback_host"` // Notice: callback host for oauth2 without scheme
AccessToken string `toml:"access_token"`
RefreshToken string `toml:"refresh_token"`
AppID string `toml:"app_id"`
AppSecret string `toml:"app_secret"`
Mode OAuth2Mode `toml:"mode"`
}
type OAuth2Mode ¶ added in v1.9.2
type OAuth2Mode int
OAuth2Mode represents the mode of OAuth2 authorization, there are two modes: 1. open browser to authorize automatically, then the gitlab server will redirect to callbackURI. 2. print a link to authorize, user can copy and paste to browser to authorize, and then the gitlab server will redirect to callbackURI as well, but user need to copy the code from browser to terminal.
- this mode is useful when the application is running in a headless environment.
const ( // OAuth2Mode_Auto means that the application will open a browser to authorize automatically. // This mode is default. OAuth2Mode_Auto OAuth2Mode = 1 // OAuth2Mode_Manual means that the application will print a link to authorize, // user can copy and paste to browser to authorize. OAuth2Mode_Manual OAuth2Mode = 2 )
func (OAuth2Mode) String ¶ added in v1.9.2
func (m OAuth2Mode) String() string
type OpFeatureContext ¶ added in v1.6.4
type OpFeatureContext struct {
// ForceCreateMergeRequest if this is true, means merge request would be create no matter whether
// merge request has been created or merged.
ForceCreateMergeRequest bool
// FeatureBranchName specify which branch name to use in the lifecycle of feature operations.
FeatureBranchName string
// AutoMergeRequest if this is true, means merge request would be merged automatically.
AutoMergeRequest bool
// ParseIssueCompatible if this is true, means parse issueName to feature in compatible way.
ParseIssueCompatible bool
}
OpFeatureContext contains all parameters of features' operations in common.
type OpHotfixContext ¶ added in v1.9.0
type OpHotfixContext struct {
// ForceCreateMergeRequest if this is true, means merge request would be create no matter whether
// merge request has been created or merged.
ForceCreateMergeRequest bool
}
type ProjectBasics ¶
ProjectBasics contains basic attributes of project.
type ProjectConfig ¶ added in v1.9.3
type ProjectConfig struct {
// ProjectName is the name of project, it is used to identify the project.
ProjectName string `toml:"project_name,omitempty"`
// The following fields are not necessary to be specified by user,
// but they are used to store the project information.
// They have higher priority than global config.
Branch *BranchSetting `toml:"branch,omitempty"`
DebugMode *bool `toml:"debug,omitempty"`
OpenBrowser *bool `toml:"open_browser,omitempty"`
}
ProjectConfig contains some fields can be specified by user, but they have higher priority than global config.
func (*ProjectConfig) AsGlobal ¶ added in v1.9.3
func (c *ProjectConfig) AsGlobal() *Config
func (*ProjectConfig) AsProject ¶ added in v1.9.3
func (c *ProjectConfig) AsProject() *ProjectConfig
func (*ProjectConfig) Type ¶ added in v1.9.3
func (c *ProjectConfig) Type() ConfigType
func (*ProjectConfig) ValidateConfig ¶ added in v1.9.3
func (c *ProjectConfig) ValidateConfig() error