From b10d792687896ba49d88066be833141a7eef865b Mon Sep 17 00:00:00 2001 From: Norwin Date: Mon, 14 Dec 2020 20:04:59 +0800 Subject: [PATCH] enforce argument to `tea ms issues` (#297) enforce argument to `tea ms issues` enforce two arguments CI.restart() CI.restart() CI.restart() CI.restart() Co-authored-by: Norwin Roosen Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/297 Reviewed-by: khmarbaise Reviewed-by: 6543 <6543@obermui.de> Co-Authored-By: Norwin Co-Committed-By: Norwin --- cmd/milestones/issues.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmd/milestones/issues.go b/cmd/milestones/issues.go index 403a4d8..9ad367b 100644 --- a/cmd/milestones/issues.go +++ b/cmd/milestones/issues.go @@ -85,7 +85,9 @@ func runMilestoneIssueList(ctx *cli.Context) error { kind = gitea.IssueTypePull } - fmt.Println(state) + if ctx.Args().Len() != 1 { + return fmt.Errorf("Must specify milestone name") + } milestone := ctx.Args().First() // make sure milestone exist @@ -111,7 +113,7 @@ func runMilestoneIssueList(ctx *cli.Context) error { func runMilestoneIssueAdd(ctx *cli.Context) error { login, owner, repo := config.InitCommand(flags.GlobalRepoValue, flags.GlobalLoginValue, flags.GlobalRemoteValue) client := login.Client() - if ctx.Args().Len() == 0 { + if ctx.Args().Len() != 2 { return fmt.Errorf("need two arguments") } @@ -137,7 +139,7 @@ func runMilestoneIssueAdd(ctx *cli.Context) error { func runMilestoneIssueRemove(ctx *cli.Context) error { login, owner, repo := config.InitCommand(flags.GlobalRepoValue, flags.GlobalLoginValue, flags.GlobalRemoteValue) client := login.Client() - if ctx.Args().Len() == 0 { + if ctx.Args().Len() != 2 { return fmt.Errorf("need two arguments") }