From cc1757cab57b4511a658735114d8b116e685420a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 7 Jun 2018 15:53:13 +0200 Subject: [PATCH] Improve scenario when `` was not given to `hub release` --- commands/release.go | 11 ++++++----- features/release.feature | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/commands/release.go b/commands/release.go index c9bf970c..86a614f4 100644 --- a/commands/release.go +++ b/commands/release.go @@ -21,6 +21,7 @@ release [--include-drafts] [--exclude-prereleases] [-L ] release show release create [-dpoc] [-a ] [-m |-F ] [-t ] release edit [] +release download release delete `, Long: `Manage GitHub releases. @@ -303,7 +304,7 @@ func formatRelease(release github.Release, format string, colorize bool) string func showRelease(cmd *Command, args *Args) { tagName := cmd.Arg(0) if tagName == "" { - utils.Check(fmt.Errorf("Missing argument TAG")) + utils.Check(fmt.Errorf(cmdRelease.Synopsis())) } localRepo, err := github.LocalRepo() @@ -344,7 +345,7 @@ func showRelease(cmd *Command, args *Args) { func downloadRelease(cmd *Command, args *Args) { tagName := cmd.Arg(0) if tagName == "" { - utils.Check(fmt.Errorf("Missing argument TAG")) + utils.Check(fmt.Errorf(cmdRelease.Synopsis())) } localRepo, err := github.LocalRepo() @@ -390,7 +391,7 @@ func downloadReleaseAsset(asset github.ReleaseAsset, gh *github.Client) (err err func createRelease(cmd *Command, args *Args) { tagName := cmd.Arg(0) if tagName == "" { - utils.Check(fmt.Errorf("Missing argument TAG")) + utils.Check(fmt.Errorf(cmdRelease.Synopsis())) return } @@ -459,7 +460,7 @@ text is the title and the rest is the description.`, tagName, project)) func editRelease(cmd *Command, args *Args) { tagName := cmd.Arg(0) if tagName == "" { - utils.Check(fmt.Errorf("Missing argument TAG")) + utils.Check(fmt.Errorf(cmdRelease.Synopsis())) return } @@ -542,7 +543,7 @@ text is the title and the rest is the description.`, tagName, project)) func deleteRelease(cmd *Command, args *Args) { tagName := cmd.Arg(0) if tagName == "" { - utils.Check(fmt.Errorf("Missing argument TAG")) + utils.Check(fmt.Errorf(cmdRelease.Synopsis())) return } diff --git a/features/release.feature b/features/release.feature index dde037f8..8c4dc451 100644 --- a/features/release.feature +++ b/features/release.feature @@ -320,6 +320,11 @@ MARKDOWN https://github.com/mislav/will_paginate/archive/v1.2.0.tar.gz\n """ + Scenario: Show release no tag + When I run `hub release show` + Then the exit status should be 1 + Then the stderr should contain "hub release show" + Scenario: Create a release Given the GitHub API server: """ @@ -394,6 +399,11 @@ MARKDOWN Then the output should contain exactly "" And "open https://github.com/mislav/will_paginate/releases/v1.2.0" should be run + Scenario: Create release no tag + When I run `hub release create -m hello` + Then the exit status should be 1 + Then the stderr should contain "hub release create" + Scenario: Edit existing release Given the GitHub API server: """ @@ -469,6 +479,11 @@ MARKDOWN Attaching release asset `hello-1.2.0.tar.gz'...\n """ + Scenario: Edit release no tag + When I run `hub release edit -m hello` + Then the exit status should be 1 + Then the stderr should contain "hub release edit" + Scenario: Download a release asset. Given the GitHub API server: """ @@ -512,6 +527,11 @@ MARKDOWN ASSET_TARBALL """ + Scenario: Download release no tag + When I run `hub release download` + Then the exit status should be 1 + Then the stderr should contain "hub release download" + Scenario: Delete a release Given the GitHub API server: """ -- GitLab