cli

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Username    string
	AccessToken string
}

func (AccessToken) AddHeaders

func (a AccessToken) AddHeaders(req *http.Request)

func (AccessToken) GetCloneCredentials

func (a AccessToken) GetCloneCredentials() git_http.BasicAuth

func (AccessToken) GetContext

func (a AccessToken) GetContext(ctx context.Context) context.Context

type Authenticator

type Authenticator interface {
	GetContext(ctx context.Context) context.Context
	GetCloneCredentials() git_http.BasicAuth
	AddHeaders(req *http.Request)
}

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

func (BasicAuth) AddHeaders

func (b BasicAuth) AddHeaders(req *http.Request)

func (BasicAuth) GetCloneCredentials

func (b BasicAuth) GetCloneCredentials() git_http.BasicAuth

func (BasicAuth) GetContext

func (b BasicAuth) GetContext(ctx context.Context) context.Context

type BitbucketCLI

type BitbucketCLI struct {
	// contains filtered or unexported fields
}

func NewCLI

func NewCLI(auth Authenticator, restUrl string) (*BitbucketCLI, error)

func (BitbucketCLI) GetReviewers

func (b BitbucketCLI) GetReviewers(revList string) []bitbucketv1.UserWithMetadata

func (*BitbucketCLI) RunPRCmd

func (b *BitbucketCLI) RunPRCmd(cmd *PrCmd)

func (*BitbucketCLI) RunPRListCmd

func (b *BitbucketCLI) RunPRListCmd(cmd *PrListCmd)

func (*BitbucketCLI) RunProjectCmd

func (b *BitbucketCLI) RunProjectCmd(cmd *ProjectCmd)

func (*BitbucketCLI) RunRepoCmd

func (b *BitbucketCLI) RunRepoCmd(cmd *RepoCmd)

func (*BitbucketCLI) SetLogger

func (b *BitbucketCLI) SetLogger(logger *logrus.Logger)

type BranchCmd

type BranchCmd struct {
	Compare *RepoBranchCompareCmd `arg:"subcommand:compare"`
	List    *RepoBranchListCmd    `arg:"subcommand:list"`
}

type Config

type Config struct {
	Username    string `yaml:"username"`
	Password    string `yaml:"password"`
	AccessToken string `yaml:"access_token"`
	Url         string `yaml:"url"`
}

type PrCmd

type PrCmd struct {
	List *PrListCmd `arg:"subcommand:list"`
}

type PrListCmd

type PrListCmd struct {
	State  string `arg:"-s,--state"`
	Output string `arg:"-o,--output"`

	FilterTitleRegex string `arg:"-t,--filter-title"`
	FilterDescRegex  string `arg:"-d,--filter-desc"`
}

type ProjectCloneCmd

type ProjectCloneCmd struct {
	Output string `arg:"-o,--output-path" default:"./"`
	Branch string `arg:"-b,--branch" default:"master"`
}

type ProjectCmd

type ProjectCmd struct {
	Key   string           `arg:"-k,required"`
	List  *ProjectListCmd  `arg:"subcommand:list"`
	Clone *ProjectCloneCmd `arg:"subcommand:clone"`
}

type ProjectListCmd

type ProjectListCmd struct {
}

type RepoBranchCompareCmd

type RepoBranchCompareCmd struct {
	FromBranch string `arg:"-f,--from,required" help:"Name of the branch to be used as base"`
	ToBranch   string `arg:"-t,--to" help:"Name of the branch to be compared to the base"`
	Count      bool   `arg:"-c,--count" help:"Just output the number of commits between to and from branch"`
}

type RepoBranchListCmd

type RepoBranchListCmd struct {
	Filter string `arg:"-f,--filter" help:"Filter to match branch names against (contains)"`
	Prefix string `arg:"-p,--prefix" help:"Only list branches that start with this prefix"`
	Regex  string `arg:"-r,--regex" help:"Only list branches that start with this prefix"`
}

type RepoCmd

type RepoCmd struct {
	ProjectKey string `arg:"-k,--key,required,env:BITBUCKET_PROJECT" help:"Project AccessToken (e.g: TOOL)"`
	Slug       string `arg:"-n,--name,required,env:BITBUCKET_REPO" help:"Slug of the repository"`

	PrCmd       *RepoPrCmd   `arg:"subcommand:pr"`
	BranchCmd   *BranchCmd   `arg:"subcommand:branch"`
	SecurityCmd *SecurityCmd `arg:"subcommand:security"`
}

type RepoPrApproveCmd

type RepoPrApproveCmd struct {
	Id int64 `arg:"-i,--id" help:"id of the PR"`
}

type RepoPrCmd

type RepoPrCmd struct {
	Approve *RepoPrApproveCmd `arg:"subcommand:approve"`
	Create  *RepoPrCreateCmd  `arg:"subcommand:create"`
	List    *RepoPrListCmd    `arg:"subcommand:list"`
	Merge   *RepoPrMergeCmd   `arg:"subcommand:merge"`
}

type RepoPrCreateCmd

type RepoPrCreateCmd struct {
	Title       string `arg:"-t,--title,required" help:"Title of this PR"`
	Description string `arg:"-d,--description" help:"Description of the PR"`

	FromRef string `arg:"-F,--from-ref,required" help:"Reference of the incoming PR, e.g: refs/heads/feature-ABC-123"` // e.g: refs/heads/feature-ABC-123
	ToRef   string `arg:"-T,--to-ref,required" help:"Target reference, e.g: refs/heads/master"`

	// From which repo? Defaults to self
	FromRepoKey  string `arg:"-K,--from-key" help:"Project AccessToken of the \"from\" repository"`
	FromRepoSlug string `arg:"-S,--from-slug" help:"Repository slug of the \"from\" repository"`

	Reviewers string `arg:"-r,--reviewers,env:BITBUCKET_REVIEWERS" help:"Comma separated list of reviewers"`
}

type RepoPrListCmd

type RepoPrListCmd struct {
	State string `arg:"-s,--state,env:BITBUCKET_LIST" help:"PR State, any of: ALL, OPEN, DECLINED, MERGED"`
}

type RepoPrMergeCmd

type RepoPrMergeCmd struct {
	Id int `arg:"-i,--id" help:"id of the PR"`
}

type ScanResult

type ScanResult struct {
	ScanKey      string        `json:"scanKey"`
	Scanned      bool          `json:"scanned"`
	Actual       bool          `json:"actual"`
	Progress     int           `json:"progress"`
	Running      bool          `json:"running"`
	Scheduled    bool          `json:"scheduled"`
	InvalidLines []interface{} `json:"invalidLines"`
	Total        int           `json:"total"`
}

type SecurityCmd

type SecurityCmd struct {
	Scan   *SecurityScanCmd   `arg:"subcommand:scan"`
	Result *SecurityResultCmd `arg:"subcommand:result"`
}

type SecurityResultCmd

type SecurityResultCmd struct{}

type SecurityScanCmd

type SecurityScanCmd struct{}

Jump to

Keyboard shortcuts

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