Commit graph

11279 commits

Author SHA1 Message Date
Issy Long
4582fed1cc cmd/ghcs/main: Add --version flag
- This is built into Cobra the argument parser. Now `ghcs --version`
  exists.
- When we prepare to bump the version, we need to remember to update
  this value else the Homebrew formula, GitHub releases and the `ghcs
  --version` output will be mismatched.
- Fixes https://github.com/github/ghcs/issues/16.
2021-07-19 18:45:18 +01:00
Issy Long
cb29b11ab2 cmd/ghcs/main: Fail gracefully if GITHUB_TOKEN entirely unset
- I have my GitHub API token in my environment as
  `HOMEBREW_GITHUB_API_TOKEN`, so with things that need `GITHUB_TOKEN` I
  have to remember to `export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN`.
- I didn't for this tool, and got this unfriendly error message:

```
❯ ghcs list
Error: error getting user: Bad credentials
Usage:
  ghcs list [flags]

Flags:
  -h, --help   help for list

error getting user: Bad credentials
```

- This moves the "do you have a `GITHUB_TOKEN`" question to the very
  beginning (no guarantees about org SSO access, just a string that
  exists), erroring out with a nice message if users don't have that
  envvar set:

```
issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ ./ghcs list
The GITHUB_TOKEN environment variable is required. Create a Personal Access Token with org SSO access at https://github.com/settings/tokens/new.

issyl0 in cetus in ~/repos/github/ghcs/cmd/ghcs on gracefully-fail-if-token-envvar-unset
❯ export GITHUB_TOKEN=$HOMEBREW_GITHUB_API_TOKEN

❯ ./ghcs list
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
|              NAME              |     REPOSITORY     |               BRANCH               |  STATE   |        CREATED AT         |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
| issyl0-github-cat-ggrpj5fvwvr  | github/cat         | dependabot/bundler/graphql-1.12.13 | Shutdown | 2021-07-13T12:36:53+01:00 |
+--------------------------------+--------------------+------------------------------------+----------+---------------------------+
```
2021-07-19 18:10:15 +01:00
Jose Garcia
570a407bac Fix directive 2021-07-19 08:00:51 -04:00
chemotaxis
23ffca45f7 Unify use of single quotes to mark shell arguments and variables
The first paragraph uses single quotes when referring to shell arguments
and variables, but the rest of the docs use double quotes.  This commit
switches to using single quotes throughout the docs.

I prefer to use single quotes inside string literals because Go uses
double quotes to define a string literal.
2021-07-19 00:46:06 -04:00
chemotaxis
5314e7c398 Add note about double quotes on non-Unix-like shells
On non-Unix-like shells like Windows Command Prompt, single quotes are
handled differently.  You need to define aliases using double quotes
instead of single quotes.

I added an inline example to illustrate the quotes.  The example is
formatted as inline code blocks in Markdown.  Unfortunately, because Go
uses backticks for raw string literals, I needed to do some rather ugly
string concatenation in order to get the backticks included in the doc
string.

This also rearranges the notes so that the platform specific notes are
at the end of the documentation.
2021-07-19 00:36:07 -04:00
Jose Garcia
798413848b Portfowarding private/public/forward now supported 2021-07-17 20:32:47 -04:00
Jose Garcia
e373c91f8b UpdateSharedServerVisibility API for Server 2021-07-18 00:05:13 +00:00
Jose Garcia
3c42ab8f7a ghcs ports v1 2021-07-16 18:45:38 -04:00
Jose Garcia
98bcdd16cf Support for GetSharedServers 2021-07-16 22:34:51 +00:00
Mislav Marohnić
496b70ac0e
Merge pull request #3934 from cli/extensions-remove-notice
Add confirmation to extensions remove
2021-07-16 15:18:38 +02:00
Mislav Marohnić
882f6d33cb Merge remote-tracking branch 'origin' into extensions-remove-notice 2021-07-16 15:12:56 +02:00
Mislav Marohnić
d68df4a9d8 Do not output error messages for nontty 2021-07-16 15:10:36 +02:00
Mislav Marohnić
30beb67cb3
Merge pull request #3941 from cli/extension-install-check
Extension install check
2021-07-16 14:58:52 +02:00
Mislav Marohnić
d6b0749ea2 Tweak error messages and add more tests for extension install name check 2021-07-16 14:52:05 +02:00
bchadwic
b3a24d273b cleaned up git.go, browse_test.go, and browse.go 2021-07-16 00:07:04 -07:00
bchadwic
25a35a6e88 added relative path access in gh browse 2021-07-15 23:38:54 -07:00
Nate Smith
4d9867243c
Merge pull request #3911 from cli/fix-extensions-panic
Fix issue in FindEntry that causes extensions and alias crash
2021-07-15 11:27:10 -05:00
Jose Garcia
349d3f382e Merge pull request #2 from github/mislav/timeout
Increase ssh command timeout and improve error message
2021-07-15 12:00:45 -04:00
Jose Garcia
44698ea1de Merge branch 'main' into mislav/timeout 2021-07-15 11:54:52 -04:00
Sam
6d0fb9b473
Merge pull request #3926 from chemotaxis/update-goreleaser-20210630
Update GoReleaser to `v0.172.1`
2021-07-15 08:12:16 -07:00
Jose Garcia
ecea5b821a Give more time to start 2021-07-15 14:35:26 +00:00
Jose Garcia
b28b4a13b7 Merge pull request #1 from github/mislav/ssh-tweaks
Improve ssh command
2021-07-15 10:32:32 -04:00
Mislav Marohnić
d506a97419 Increase ssh command timeout and improve error message
- My `github/github` codespace failed to start within 10s
- Output more precise error message
2021-07-15 16:10:03 +02:00
Mislav Marohnić
d46420e812 Improve ssh command
- Ensure parent process exits when `ssh` sub-process is done
- Enable connections to `github/github` when `--profile` flag wasn't given
2021-07-15 16:07:23 +02:00
Des Preston
45a4257612 add --discussion-category flag to release cmd
Flag for signaling that a discussion should be created with the given
category for the release. Discussions are not supported for draft
releases. If a discussion category is given for a draft, an err will be
shown.

Closes #3381
2021-07-15 10:07:21 -04:00
Jose Garcia
e108b5d18f Merge branch 'main' of github.com:github/ghcs 2021-07-15 08:49:28 -04:00
Jose Garcia
a5f558bf2a Makes secrets work 2021-07-15 08:49:18 -04:00
Mislav Marohnić
5c21c949a0 Merge remote-tracking branch 'origin' into fix/private-repo-create 2021-07-15 12:58:00 +02:00
Mislav Marohnić
0ad153f696 Separate payload structs for REST vs GraphQL repo create
This enforces strict separation between serialization structs used for
repository creation payload with respect to whether GraphQL or REST was
used. Before, a field added to a GraphQL payload would leak to REST
payload (and vice versa).
2021-07-15 12:56:14 +02:00
Jose Garcia
53fd96d22e Some polish and module replacement 2021-07-14 20:47:06 -04:00
Jose Garcia
4a0eaa3da5 Latest and greatest 2021-07-14 16:12:30 -04:00
Mislav Marohnić
aed8966f75
Merge pull request #3995 from despreston/3989-fix-pr-create-confirm
fix repo create --confirm
2021-07-14 17:26:15 +02:00
Des Preston
17b58bf0b2 fix repo create --confirm
Respect the --confirm flag when deciding whether to prompt for gitignore
and license creation during `repo create`

Fixes #3989
2021-07-14 09:59:04 -04:00
bchadwic
158a15160d Changed name from SHA to Commit 2021-07-14 01:19:55 -07:00
Des Preston
c95f30af80 add browser option to config
Allows setting the path to the browser using the config.

Closes #858
2021-07-13 15:07:57 -04:00
Gowtham Munukutla
e600ce054a fix description related bugs in creating a template repo 2021-07-13 09:38:34 +05:30
Gowtham Munukutla
0a9fcb9332 Merge branch 'trunk' of https://github.com/cli/cli into fix/private-repo-create 2021-07-13 09:30:48 +05:30
Benjamin Chadwick
0e18db2b11
Merge branch 'cli:trunk' into browse-commit 2021-07-12 14:26:10 -07:00
Nate Smith
161de77fd7
Merge pull request #3943 from silby/browse-output
Add a no-browser mode to gh browse
2021-07-12 13:39:30 -05:00
nate smith
98d3b7cc79 don't check Fprintf error
we don't ever check the return of Fprintf anywhere else in the codebase
so doing it here suggests that it's a special case. if it's something we
should be doing we can circle back and do it more consistently.
2021-07-12 13:05:49 -05:00
Nate Smith
6c7bff2524
Merge pull request #3912 from bchadwic/trunk
Added colors to issue / pr labels in the terminal
2021-07-12 12:46:01 -05:00
Mislav Marohnić
cd3df4cdf9
Merge pull request #3982 from despreston/des/err-return
Return SilentError if completed run failed
2021-07-12 17:05:41 +02:00
Mislav Marohnić
13037226c2 Add test for gh run watch --exit-status with completed runs 2021-07-12 16:58:45 +02:00
Mislav Marohnić
4dc23d869e Bump gojq to latest version
Upgrades gojq, the library that powers the `--jq` filter flag for JSON.
This upgrade is purely housekeeping and not to address any particular
issue reported with gh.

https://github.com/itchyny/gojq/releases/tag/v0.12.4
2021-07-12 15:34:08 +02:00
Mislav Marohnić
079542d35c Bump Survey library for cursor improvements
https://github.com/AlecAivazis/survey/releases/tag/v2.2.14
2021-07-12 14:47:40 +02:00
Gowtham Munukutla
a1f26057de gofmt 2021-07-10 23:04:46 +05:30
Gowtham Munukutla
52550f0bee fix private repo creation in case of ignore templates 2021-07-10 23:03:16 +05:30
Des Preston
1980cc83b9 return SilentError if completed run failed
If `gh run watch ${ID} --exit-status` is run and "ID" is the ID of a
completed job that failed, return a SilentError. This ensures that the
program returns a non-zero code.

Fixes #3962
2021-07-09 11:54:58 -04:00
Jose Garcia
04a6383ccb Tidy up go.mod 2021-07-07 08:00:01 -04:00
Jose Garcia
6cd0aa7a90 Working albeit not imperfect implementation 2021-07-06 09:12:43 -04:00