Commit graph

96 commits

Author SHA1 Message Date
Nate Smith
d908320050
Merge pull request #786 from cli/oauth-read-org
Ask for `read:org` OAuth scope, warn for outdated tokens
2020-04-28 20:23:44 -05:00
Nate Smith
fb7b5446d1
Update command/root.go
Co-Authored-By: Corey Johnson <probablycorey@gmail.com>
2020-04-28 20:19:52 -05:00
Nate Smith
ef5932f6cb
Merge pull request #821 from cli/basic-client-auth
Fix gh updater mechanism for unauthenticated users
2020-04-28 20:15:17 -05:00
Corey Johnson
3d2ee3c9b2 fix whitespace 2020-04-27 10:07:47 -07:00
Mislav Marohnić
3aaa231cc5 Guide user through re-authorization flow if read:org scope is missing
How this works for people with existing OAuth tokens:

    $ gh issue list -L1
    Notice: additional authorization required
    Press Enter to open github.com in your browser...
    [auth flow in the browser...]
    Authentication complete. Press Enter to continue...

    Showing 1 of 132 issues in cli/cli
    ...

Users of Personal Access Tokens get a different notice:

    Warning: gh now requires the `read:org` OAuth scope.
    Visit https://github.com/settings/tokens and edit your token to enable `read:org`
    or generate a new token and paste it via `gh config set -h github.com oauth_token MYTOKEN`
2020-04-23 18:20:21 +02:00
Mislav Marohnić
84ac3d412e Fix gh updater mechanism for unauthenticated users
Per code documentation: "BasicClient returns an API client that borrows
from but does not depend on user configuration". This means that any
errors while reading `oauth_token` should be tolerated.
2020-04-23 15:41:37 +02:00
Mislav Marohnić
8ed9a0324e Merge remote-tracking branch 'origin/master' into oauth-read-org 2020-04-23 15:35:35 +02:00
Corey Johnson
e68be52ed0 Use the correct field 2020-04-22 14:03:44 -07:00
Corey Johnson
4b2382c737 Merge branch 'heathy-helping' of https://github.com/cli/cli into heathy-helping 2020-04-22 14:02:09 -07:00
Corey Johnson
c9d5935ee3 move to use 2020-04-22 14:00:08 -07:00
Corey Johnson
4dff85d3c1 Merge remote-tracking branch 'origin/master' into heathy-helping 2020-04-22 13:56:53 -07:00
Corey Johnson
c064b07e6d Add quote 2020-04-22 13:51:35 -07:00
Corey Johnson
0d79257312
use backets
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:50:52 -07:00
Corey Johnson
833f8b4f2c
Update command/root.go
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:50:06 -07:00
Corey Johnson
6d20283a7a Move feedback to the bottom 2020-04-22 13:49:42 -07:00
Corey Johnson
b5299ef5d7
pointy brackets ftw
Co-Authored-By: Amanda Pinsker <ampinsk@github.com>
2020-04-22 13:46:51 -07:00
vilmibm
bec58ede98 respect ssh
this adds recognition of the git_protocol setting when:

- creating a repo
- cloning a repo
- forking a repo
- forking/pushing during pr create
- checking out a PR

additionally, it:

- consolidates remote adding to use AddRemote; this introduces a fetch
where there previously hadn't been one
- changes repo clone to accept an ssh url
- changes repo fork to accept an ssh url

i just added basic unit tests; adding new test cases for all of the
above scenarios seemed like diminishing returns.
2020-04-22 14:21:01 -05:00
Corey Johnson
a4429aae41 rearrange code 2020-04-22 10:00:33 -07:00
Corey Johnson
be51d095ea Separating core from non-core commands 2020-04-21 13:30:07 -07:00
vilmibm
d4dd4a68bf fix error handling 2020-04-21 11:25:23 -05:00
vilmibm
c4693077aa move config stuff to its own package 2020-04-20 13:57:16 -05:00
vilmibm
815f461e8b more strict erroring around missing user/token 2020-04-20 12:49:46 -05:00
vilmibm
a325db3051 new config infrastructure
- adds config get and config set commands
- supports arbitrary k/v strings set at top and host level
- supports writing an updated config, preserving comments
- supports mostly lazy evaluation of yaml
2020-04-17 15:17:44 -05:00
Mislav Marohnić
3d566dc5a6 Detect and warn about read:org OAuth scope being missing 2020-04-15 17:25:15 +02:00
Mislav Marohnić
734497a8d8
Code fixes informed by golangci-lint failures (#738) 2020-04-03 16:33:34 +02:00
Dmitry Sharshakov
d755288cdf Implement review comments 2020-03-17 20:05:53 +03:00
Dmitry Sharshakov
45c2a16d49 Don't list remotes when --repo flag is set 2020-03-14 23:14:38 +03:00
Mislav Marohnić
7c11f7655a No need to opt in to shadow-cat API preview
This was needed for draft pull requests, but these APIs were public
since Feburary 2020.
2020-03-10 13:59:56 +01:00
Mislav Marohnić
42b40b1179 No longer need to opt into pe_mobile API flag
`pe_mobile` was required to get access to `reviewDecision` and
`statusCheckRollup`, but both are now public in GitHub API.
2020-03-10 13:58:06 +01:00
Christian Muehlhaeuser
fdfcecfcb6 Fix typo in 'overridden' 2020-03-04 14:20:55 +00:00
Mislav Marohnić
371d4f5c6a Ensure that gh <command> -h is equivalent to --help
This compensates for what appears to be a bug in Cobra, which only
handles `pflag.ErrHelp` unless the error is wrapped. It also might be
that Cobra doesn't recognize Go 1.13-style error wrapping.
2020-03-03 20:05:44 +01:00
Dasio
19cc79cac8 Removed explicit capacity in slice initialization 2020-02-26 15:44:52 +01:00
Dasio
8aa46c236e Init slice with provided capacity if it's known in advance 2020-02-24 22:16:41 +01:00
Mislav Marohnić
ac94ae5872 Return interface from determineBaseRepo(), not pointer to interface
It's sufficient to return a value of type `ghrepo.Interface` instead of
a pointer to an interface. This avoids having to use `*` whenever we are
passing the result of `determineBaseRepo()` into another function that
accepts a `ghrepo.Interface`.
2020-02-24 13:40:58 +01:00
Mislav Marohnić
9c00ac0224 Tweak verbose HTTP logging
- log headers only in DEBUG=api mode
- enable color output on stderr
- hide little-useful TLS debbuging info
- ensure all request headers are logged
2020-02-21 12:57:00 +01:00
Mislav Marohnić
408b565fd9 Allow setting version via ldflags again 2020-02-18 13:47:57 +01:00
Colin Arnott
de6e99aa75
command: default to toolchain version
Since the Go toolchain is able to extract the module version at build
time, we should use that as a default instead of DEV. This means
customers installing via go-get will get the correct version.

Unfortunately, the toolchain does not store when the build occurs, so
BuildTime now defaults to the empty string. It is still set if build
officially, just not for go-get.
2020-02-18 07:55:54 +00:00
vilmibm
6732aa9725 fix tests 2020-02-12 08:48:25 -06:00
vilmibm
135c63aa36 remove --self for now 2020-02-11 20:46:46 -06:00
vilmibm
c93c5f7668 move determineBaseRepo to root 2020-02-11 19:44:49 -06:00
HowJMay
c517fd79b9 fix: Fix typos
Fix typos in files
2020-02-02 01:49:11 +08:00
Mislav Marohnić
2a49efc789 Fix gh version printing the correct changelog link
Previously, the version string didn't match the `vX.Y.Z` pattern because
the wrong variable was passed to `changelogURL`.
2020-01-29 16:03:10 +01:00
Mislav Marohnić
7b28605e6f Fix current changelog link in gh version
Also allow pre-release tags.
2020-01-28 18:31:12 +01:00
Mislav Marohnić
1c74227ed7 Use new repo name for update notifier and changelog 2020-01-28 18:22:29 +01:00
Amanda Pinsker
250286d531
Add updated feedback form link 2020-01-27 12:55:57 -08:00
Mislav Marohnić
a710893fc1 Rename to cli/cli 2020-01-24 16:08:52 +01:00
Nate Smith
3764e25921 Merge pull request #248 from github/main-pkg
Move main package to under `cmd/`
2020-01-23 09:34:54 -06:00
Mislav Marohnić
4f6dfee965 Merge remote-tracking branch 'origin/master' into pr-create-just-works-TM 2020-01-23 14:08:07 +01:00
Mislav Marohnić
537b0a8429 Friendlier output for network connectivity errors
For `net.DNSError`, the full error message can be scary. Instead, print "error
connecting to HOST" and hint that the user should check their internet connection
or githubstatus.com.

When $DEBUG is set, the full DNS error is printed like before.

Fixes #206
2020-01-23 12:48:10 +01:00
Mislav Marohnić
0b0fd42ef3 Dump HTTP request/response bodies when DEBUG=api 2020-01-22 19:35:39 +01:00