mirror of
https://gitea.com/gitea/tea.git
synced 2024-06-03 10:11:22 +05:30
release create: accept tag also via argument
This commit is contained in:
parent
004398f048
commit
8ffb00c5f5
|
@ -22,8 +22,8 @@ var CmdReleaseCreate = cli.Command{
|
|||
Name: "create",
|
||||
Aliases: []string{"c"},
|
||||
Usage: "Create a release",
|
||||
Description: `Create a release`,
|
||||
ArgsUsage: " ", // command does not accept arguments
|
||||
Description: `Create a release for a new or existing git tag`,
|
||||
ArgsUsage: "[<tag>]",
|
||||
Action: runReleaseCreate,
|
||||
Flags: append([]cli.Flag{
|
||||
&cli.StringFlag{
|
||||
|
@ -66,8 +66,16 @@ func runReleaseCreate(cmd *cli.Context) error {
|
|||
ctx := context.InitCommand(cmd)
|
||||
ctx.Ensure(context.CtxRequirement{RemoteRepo: true})
|
||||
|
||||
tag := ctx.String("tag")
|
||||
if cmd.Args().Present() {
|
||||
if len(tag) != 0 {
|
||||
return fmt.Errorf("Ambiguous arguments: provide tagname via --tag or argument, but not both.")
|
||||
}
|
||||
tag = cmd.Args().First()
|
||||
}
|
||||
|
||||
release, resp, err := ctx.Login.Client().CreateRelease(ctx.Owner, ctx.Repo, gitea.CreateReleaseOption{
|
||||
TagName: ctx.String("tag"),
|
||||
TagName: tag,
|
||||
Target: ctx.String("target"),
|
||||
Title: ctx.String("title"),
|
||||
Note: ctx.String("note"),
|
||||
|
|
Loading…
Reference in a new issue