Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented Jul 17, 2020

Fixes #1377

Bonus: prints usage information when passing no arguments and nothing on stdin

$ gh gist create
no filenames passed and nothing on STDIN

Usage:  gh gist create [<filename>... | -] [flags]

Flags:
  -d, --desc string   A description for this gist
  -p, --public        List the gist publicly (default: private)

Also:

  • avoids unnecessarily Stat-ing stdin if any filename arguments are passed
  • raises clearer error in case - is passed multiple times as a filename
  • uses new syntax for HTTP stubs in test

mislav added 4 commits July 17, 2020 18:24
Goals:
- print command usage information on `gh gist create` when no args nor stdin
- disallow passing `-` as argument multiple times
- utilize Cobra's Args to do argument validation
- use testify
- verify that the HTTP request is a POST to `/gists`
- more precise POST params matching in assertion
Trying to generally avoid "when true" in descriptions of boolean flags
@vilmibm vilmibm self-requested a review July 20, 2020 21:32
@mislav mislav merged commit 6a48a60 into trunk Jul 21, 2020
@mislav mislav deleted the gist-create-stdin branch July 21, 2020 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Passing “-“ as file name to read from standard input breaks gh gist create

2 participants