cmd

package
v0.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const VERSION = "0.0.3"

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"}
	SyncLocal   = Flag{Short: "s", Long: "sync-local", Description: "Sync the local branch with the remote branch. Only relevant if the target branch is the same as the local branch. Incompatible with --use-pr flag.", Type: "bool"}
	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"}
	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"}
	DryRun      = Flag{Short: "d", Long: "dry-run", Description: "Show which files would be committed.", Type: "bool"}
)
View Source
var RootPath string

Functions

func Execute

func Execute()

func GetFileSelection added in v0.0.7

func GetFileSelection(args []string, commitAll bool, commitUntracked bool) ([]string, error)

func ListAllFilesByPattern added in v0.0.7

func ListAllFilesByPattern(patterns ...string) ([]string, error)

func ListStagedFiles added in v0.0.7

func ListStagedFiles() ([]string, error)

func ListUntrackedFiles added in v0.0.7

func ListUntrackedFiles() ([]string, error)

func ValidateGitRepo added in v0.0.7

func ValidateGitRepo() (string, error)

Types

type CommitSettings added in v0.0.7

type CommitSettings struct {
	CommitMessage  string
	CommitToBranch string
}

type Flag added in v0.0.7

type Flag struct {
	Short       string
	Long        string
	Description string
	Required    bool
	Type        string // "bool", "string", "stringSlice"
	Default     string
}

type PrSettings added in v0.0.7

type PrSettings struct {
	BaseRef     string
	HeadRef     string
	Title       string
	Description string
	Labels      []string
}

type RunSettings added in v0.0.7

type RunSettings struct {
	PrSettings     *PrSettings
	CommitSettings *CommitSettings
	FileSelection  []string
	SyncLocal      bool
	DryRun         bool
}

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()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL