Documentation
¶
Index ¶
- Constants
- Variables
- func AssociateCommitWithBranch(branch string, commitSha string) error
- func CreateBlob(file string) (string, error)
- func CreateCommitFromTree(latestCommit, treeSha, commitMessage string) (string, error)
- func CreatePullRequest(baseRef, headRef, title, description string, labels []string) error
- func CreateTree(baseTree string, blobs []BlobInfo) (string, error)
- func EnsureBranchesExist(targetBranch, intermediateBranch string, repoSettings *RepoSettings) (string, error)
- func Execute()
- func GetFileSelection(args []string, commitAll bool, commitUntracked bool) ([]string, error)
- func GetTreeTip(commitSha string) (string, error)
- func ListAllFilesByPattern(patterns ...string) ([]string, error)
- func ListStagedFiles() ([]string, error)
- func ListUntrackedFiles() ([]string, error)
- func ValidateAllLabels(labels []string) error
- func ValidateLocalGit() (string, error)
- type BlobInfo
- type BranchDescriptionResponse
- type CommandExecutor
- type CommitSettings
- type DefaultCommandExecutor
- type Flag
- type LabelRequest
- type LabelResponse
- type PrRequest
- type PrResponse
- type PrSettings
- type RepoDescriptionResponse
- type RepoSettings
- type RunSettings
- type ShaResponse
Constants ¶
View Source
const VERSION = "v0.2.5"
VERSION number: changed in CI
Variables ¶
View Source
var ( BranchFlag = Flag{ Short: "B", Long: "branch", Description: "The name of the target branch of the commit. When used in conjunction with the --use-pr " + "flag, the branch is the base ref of the PR created. Otherwise, the commit is pushed directly to the " + "branch.", Required: true, Type: "string", } MessageFlag = Flag{ Short: "m", Long: "message", Description: "The message connected to the commit. When used in conjunction with --use-pr, the " + "commit message is used as the PR title and PR description, unless overridden.", Required: true, Type: "string", } UsePrFlag = Flag{ Short: "P", Long: "use-pr", Description: "Create a PR rather than committing directly to the branch. Unless a head-ref is " + "specified manually, the head ref name is generated in the format of <BASE REF>-<RANDOM SALT>.", Required: false, Type: "bool", } HeadRefFlag = Flag{Short: "H", Long: "head-ref", Description: "The name of the branch created with the base ref being `--branch`. Only relevant if used in conjunction with the --use-pr flag.", Type: "string"} PrTitleFlag = Flag{Short: "T", Long: "title", Description: "The title of the PR created. Only relevant if used in conjunction with the --use-pr flag. If not specified, the PR title will be the commit message.", Type: "string"} PrDescFlag = Flag{Short: "D", Long: "pr-description", Description: "The description of the PR created. Only relevant if used in conjunction with the --use-pr flag. If not specified, the PR title will be the commit message.", Type: "string"} PrLabelFlag = Flag{Short: "l", Long: "label", Description: "A list of labels to add to the PR created. Only relevant if used in conjunction with the --use-pr flag. Labels can be added recursively -- i.e. -l feature -l blocked.", Type: "stringSlice"} AllFlag = Flag{Short: "A", Long: "all", Description: "Commit all tracked files that have changed. Only relevant if the target branch is the same as the local branch.", Type: "bool", Default: "false"} Untracked = Flag{Short: "U", Long: "untracked", Description: "Include untracked files in the commit. Only relevant if used in conjunction with the --all flag.", Type: "bool", Default: "false"} DryRun = Flag{Short: "d", Long: "dry-run", Description: "Show which files would be committed.", Type: "bool", Default: "false"} )
Functions ¶
func AssociateCommitWithBranch ¶ added in v0.0.9
func CreateBlob ¶ added in v0.0.9
func CreateCommitFromTree ¶ added in v0.0.9
func CreatePullRequest ¶ added in v0.0.9
func CreateTree ¶ added in v0.0.9
func EnsureBranchesExist ¶ added in v0.0.8
func EnsureBranchesExist(targetBranch, intermediateBranch string, repoSettings *RepoSettings) (string, error)
func GetFileSelection ¶ added in v0.0.7
func GetTreeTip ¶ added in v0.0.9
func ListAllFilesByPattern ¶ added in v0.0.7
func ListStagedFiles ¶ added in v0.0.7
func ListUntrackedFiles ¶ added in v0.0.7
func ValidateAllLabels ¶ added in v0.0.9
func ValidateLocalGit ¶ added in v0.0.8
Types ¶
type BlobInfo ¶ added in v0.0.9
type BlobInfo struct {
Path string `json:"path"`
Mode string `json:"mode"`
Type string `json:"type"`
Sha *string `json:"sha"`
}
func CreateBlobs ¶ added in v0.0.9
CreateBlobs creates the leaves of the trees that commits reference.
type BranchDescriptionResponse ¶ added in v0.0.8
type BranchDescriptionResponse struct {
Commit struct {
SHA string `json:"sha"`
} `json:"commit"`
}
type CommandExecutor ¶ added in v0.0.12
CommandExecutor is an interface for executing commands.
type CommitSettings ¶ added in v0.0.7
type DefaultCommandExecutor ¶ added in v0.0.12
type DefaultCommandExecutor struct{}
DefaultCommandExecutor is the default implementation of CommandExecutor.
func (*DefaultCommandExecutor) RunCommand ¶ added in v0.0.12
func (d *DefaultCommandExecutor) RunCommand(name string, arg ...string) ([]byte, error)
RunCommand executes a command and returns its output.
type LabelRequest ¶ added in v0.0.9
type LabelRequest struct {
Labels []string `json:"labels"`
}
type LabelResponse ¶ added in v0.0.9
type LabelResponse struct {
Name string `json:"name"`
}
type PrResponse ¶ added in v0.0.9
type PrSettings ¶ added in v0.0.7
type RepoDescriptionResponse ¶ added in v0.0.8
type RepoDescriptionResponse struct {
DefaultBranch string `json:"default_branch"`
}
type RepoSettings ¶ added in v0.0.8
func ValidateGitRemote ¶ added in v0.0.8
func ValidateGitRemote() (*RepoSettings, error)
type RunSettings ¶ added in v0.0.7
type RunSettings struct {
PrSettings *PrSettings
CommitSettings *CommitSettings
RepoSettings *RepoSettings
FileSelection []string
DryRun bool
}
func ValidateAndConfigureRun ¶ added in v0.0.8
func ValidateAndConfigureRun(args []string, cmd *cobra.Command, rs *RepoSettings) (*RunSettings, error)
func (*RunSettings) Commit ¶ added in v0.0.7
func (rn *RunSettings) Commit() error
func (*RunSettings) ExecuteDryRun ¶ added in v0.0.7
func (rn *RunSettings) ExecuteDryRun()
type ShaResponse ¶ added in v0.0.9
type ShaResponse struct {
Sha string `json:"sha"`
}
Click to show internal directories.
Click to hide internal directories.