mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 09:58:29 +02:00
tea pr create: make local repo optional (#393)
this is a partial fix to #378, making the command available outside of a local repo. new behaviour: - when run interactively without local repo context, the head repo prompt is not pre-populated - when run with flags without local repo context, it will complain unless `--head` is specified refactor: - pass TeaContext down to task.CreatePull Co-authored-by: Norwin <git@nroo.de> Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/393 Reviewed-by: Alexey 〒erentyev <axifive@noreply.gitea.io> Reviewed-by: 6543 <6543@obermui.de> Co-authored-by: Norwin <noerw@noreply.gitea.io> Co-committed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -35,11 +35,10 @@ var CmdPullsCreate = cli.Command{
|
||||
|
||||
func runPullsCreate(cmd *cli.Context) error {
|
||||
ctx := context.InitCommand(cmd)
|
||||
ctx.Ensure(context.CtxRequirement{LocalRepo: true})
|
||||
|
||||
// no args -> interactive mode
|
||||
if ctx.NumFlags() == 0 {
|
||||
return interact.CreatePull(ctx.Login, ctx.Owner, ctx.Repo)
|
||||
return interact.CreatePull(ctx)
|
||||
}
|
||||
|
||||
// else use args to create PR
|
||||
@ -49,9 +48,7 @@ func runPullsCreate(cmd *cli.Context) error {
|
||||
}
|
||||
|
||||
return task.CreatePull(
|
||||
ctx.Login,
|
||||
ctx.Owner,
|
||||
ctx.Repo,
|
||||
ctx,
|
||||
ctx.String("base"),
|
||||
ctx.String("head"),
|
||||
opts,
|
||||
|
Reference in New Issue
Block a user