提交 cc1757ca 编写于 作者: M Mislav Marohnić

Improve scenario when `<TAG>` was not given to `hub release`

上级 c3c34ef2
......@@ -21,6 +21,7 @@ release [--include-drafts] [--exclude-prereleases] [-L <LIMIT>]
release show <TAG>
release create [-dpoc] [-a <FILE>] [-m <MESSAGE>|-F <FILE>] [-t <TARGET>] <TAG>
release edit [<options>] <TAG>
release download <TAG>
release delete <TAG>
`,
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
}
......
......@@ -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:
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册