branch

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cobra.Command{
	Use:   "branch",
	Short: "Manage branches",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("Branch requires a subcommand:")
		for _, command := range cmd.Commands() {
			fmt.Println(command.Name())
		}
	},
}

Command represents this folder's command

Functions

func GetBranchNames

func GetBranchNames(context context.Context, cmd *cobra.Command, args []string, toComplete string) (names []string, err error)

GetBranchNames gets the branch names of a repository

Types

type Branch

type Branch struct {
	Name                 string        `json:"name"                             mapstructure:"name"`
	Target               commit.Commit `json:"target"                           mapstructure:"target"`
	Links                common.Links  `json:"links"                            mapstructure:"links"`
	MergeStrategies      []string      `json:"merge_strategies,omitempty"       mapstructure:"merge_strategies"`
	DefaultMergeStrategy string        `json:"default_merge_strategy,omitempty" mapstructure:"default_merge_strategy"`
}

func GetBranches

func GetBranches(context context.Context, cmd *cobra.Command) (branches []Branch, err error)

GetBranches gets the branches of a repository

func GetCurrentBranch

func GetCurrentBranch() (*Branch, error)

GetCurrentBranch gets the current branch from Git repository

func (Branch) GetHeaders

func (branch Branch) GetHeaders(cmd *cobra.Command) []string

GetHeaders gets the header for a table

implements common.Tableable

func (Branch) GetRow

func (branch Branch) GetRow(headers []string) []string

GetRow gets the row for a table

implements common.Tableable

func (Branch) GetType

func (branch Branch) GetType() string

GetType returns the branch type

func (Branch) MarshalJSON

func (branch Branch) MarshalJSON() ([]byte, error)

MarshalJSON custom JSON marshalling for Branch

implements json.Marshaler

func (Branch) String

func (branch Branch) String() string

String gets a string representation of this Branch

implements fmt.Stringer

func (*Branch) UnmarshalJSON

func (branch *Branch) UnmarshalJSON(data []byte) error

UnmarshalJSON custom JSON unmarshalling for Branch

implements json.Unmarshaler

func (*Branch) Validate

func (branch *Branch) Validate() error

Validate validates a Branch

type BranchReference

type BranchReference struct {
	Type string `json:"type" mapstructure:"type"`
	Name string `json:"name" mapstructure:"name"`
}

func NewReference

func NewReference(name string) *BranchReference

NewReference creates a new BranchReference

type Branches

type Branches []Branch

func (Branches) GetHeaders

func (branches Branches) GetHeaders(cmd *cobra.Command) []string

GetHeaders gets the header for a table

implements common.Tableables

func (Branches) GetRowAt

func (branches Branches) GetRowAt(index int, headers []string) []string

GetRowAt gets the row for a table

implements common.Tableables

func (Branches) Size

func (branches Branches) Size() int

Size gets the number of elements

implements common.Tableables

Jump to

Keyboard shortcuts

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