pulls

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CmdPullsApprove = cli.Command{
	Name:        "approve",
	Aliases:     []string{"lgtm", "a"},
	Usage:       "Approve a pull request",
	Description: "Approve a pull request",
	ArgsUsage:   "<pull index> [<comment>]",
	Action: func(cmd *cli.Context) error {
		ctx := context.InitCommand(cmd)
		ctx.Ensure(context.CtxRequirement{RemoteRepo: true})

		if ctx.Args().Len() == 0 {
			return fmt.Errorf("Must specify a PR index")
		}

		idx, err := utils.ArgToIndex(ctx.Args().First())
		if err != nil {
			return err
		}

		comment := strings.Join(ctx.Args().Tail(), " ")

		return task.CreatePullReview(ctx, idx, gitea.ReviewStateApproved, comment, nil)
	},
	Flags: flags.AllDefaultFlags,
}

CmdPullsApprove approves a PR

View Source
var CmdPullsCheckout = cli.Command{
	Name:        "checkout",
	Aliases:     []string{"co"},
	Usage:       "Locally check out the given PR",
	Description: `Locally check out the given PR`,
	Action:      runPullsCheckout,
	ArgsUsage:   "<pull index>",
	Flags: append([]cli.Flag{
		&cli.BoolFlag{
			Name:    "branch",
			Aliases: []string{"b"},
			Usage:   "Create a local branch if it doesn't exist yet",
		},
	}, flags.AllDefaultFlags...),
}

CmdPullsCheckout is a command to locally checkout the given PR

View Source
var CmdPullsClean = cli.Command{
	Name:        "clean",
	Usage:       "Deletes local & remote feature-branches for a closed pull request",
	Description: `Deletes local & remote feature-branches for a closed pull request`,
	ArgsUsage:   "<pull index>",
	Action:      runPullsClean,
	Flags: append([]cli.Flag{
		&cli.BoolFlag{
			Name:  "ignore-sha",
			Usage: "Find the local branch by name instead of commit hash (less precise)",
		},
	}, flags.AllDefaultFlags...),
}

CmdPullsClean removes the remote and local feature branches, if a PR is merged.

View Source
var CmdPullsClose = cli.Command{
	Name:        "close",
	Usage:       "Change state of a pull request to 'closed'",
	Description: `Change state of a pull request to 'closed'`,
	ArgsUsage:   "<pull index>",
	Action: func(ctx *cli.Context) error {
		var s = gitea.StateClosed
		return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
	},
	Flags: flags.AllDefaultFlags,
}

CmdPullsClose closes a given open pull request

View Source
var CmdPullsCreate = cli.Command{
	Name:        "create",
	Aliases:     []string{"c"},
	Usage:       "Create a pull-request",
	Description: "Create a pull-request",
	Action:      runPullsCreate,
	Flags: append([]cli.Flag{
		&cli.StringFlag{
			Name:  "head",
			Usage: "Set head branch (default is current one)",
		},
		&cli.StringFlag{
			Name:    "base",
			Aliases: []string{"b"},
			Usage:   "Set base branch (default is default branch)",
		},
	}, flags.IssuePREditFlags...),
}

CmdPullsCreate creates a pull request

View Source
var CmdPullsList = cli.Command{
	Name:        "list",
	Aliases:     []string{"ls"},
	Usage:       "List pull requests of the repository",
	Description: `List pull requests of the repository`,
	Action:      RunPullsList,
	Flags:       flags.IssuePRFlags,
}

CmdPullsList represents a sub command of issues to list pulls

View Source
var CmdPullsReject = cli.Command{
	Name:        "reject",
	Usage:       "Request changes to a pull request",
	Description: "Request changes to a pull request",
	ArgsUsage:   "<pull index> <reason>",
	Action: func(cmd *cli.Context) error {
		ctx := context.InitCommand(cmd)
		ctx.Ensure(context.CtxRequirement{RemoteRepo: true})

		if ctx.Args().Len() < 2 {
			return fmt.Errorf("Must specify a PR index and comment")
		}

		idx, err := utils.ArgToIndex(ctx.Args().First())
		if err != nil {
			return err
		}

		comment := strings.Join(ctx.Args().Tail(), " ")

		return task.CreatePullReview(ctx, idx, gitea.ReviewStateRequestChanges, comment, nil)
	},
	Flags: flags.AllDefaultFlags,
}

CmdPullsReject requests changes to a PR

View Source
var CmdPullsReopen = cli.Command{
	Name:        "reopen",
	Aliases:     []string{"open"},
	Usage:       "Change state of a pull request to 'open'",
	Description: `Change state of a pull request to 'open'`,
	ArgsUsage:   "<pull index>",
	Action: func(ctx *cli.Context) error {
		var s = gitea.StateOpen
		return editPullState(ctx, gitea.EditPullRequestOption{State: &s})
	},
	Flags: flags.AllDefaultFlags,
}

CmdPullsReopen reopens a given closed pull request

View Source
var CmdPullsReview = cli.Command{
	Name:        "review",
	Usage:       "Interactively review a pull request",
	Description: "Interactively review a pull request",
	ArgsUsage:   "<pull index>",
	Action: func(cmd *cli.Context) error {
		ctx := context.InitCommand(cmd)
		ctx.Ensure(context.CtxRequirement{RemoteRepo: true})

		if ctx.Args().Len() != 1 {
			return fmt.Errorf("Must specify a PR index")
		}

		idx, err := utils.ArgToIndex(ctx.Args().First())
		if err != nil {
			return err
		}

		return interact.ReviewPull(ctx, idx)
	},
	Flags: flags.AllDefaultFlags,
}

CmdPullsReview starts an interactive review session

Functions

func RunPullsList

func RunPullsList(cmd *cli.Context) error

RunPullsList return list of pulls

Types

This section is empty.

Jump to

Keyboard shortcuts

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