Commit graph

134 commits

Author SHA1 Message Date
Mislav Marohnić
64fda21116 Avoid ever invoking go-homedir when config was found in a new location 2021-01-22 20:22:32 +01:00
Matthew Gleich
7d9461b819 ♻️ Refactor to use os.UserHomeDir() 2021-01-22 18:51:28 +01:00
Mislav Marohnić
06cf2c9f81 Merge remote-tracking branch 'origin' into cmd-stub-new 2021-01-22 16:31:29 +01:00
Mislav Marohnić
f1a9da40a4
Merge pull request #2812 from cli/updater-dev-version-match
Update notifier: avoid false positives when gh is built from source
2021-01-21 15:11:23 +01:00
Mislav Marohnić
c9407b2629 More descriptive error when aborting auth due to environment variables
Old message:

    read-only token in GH_TOKEN cannot be modified

This message was vague and some users did not understand that this
refers to the value that is read from environment variables.

New message:

    $ GH_TOKEN=123 ghd auth login -h github.com
    The value of the GH_TOKEN environment variable is being used for authentication.
    To have GitHub CLI store credentials instead, first clear the value from the environment.
2021-01-20 18:27:35 +01:00
Mislav Marohnić
82d19b73d6 Update notifier: avoid false positives when gh is built from source
When gh was built from source, the version number will look something
like this since it's taken from `git describe`:

    v1.4.0-34-g{SHA}

When compared as semver against `v1.4.0`, the latter version is falsely
reported as newer. This is because the output of `git describe` wasn't
meant to be interpreted as semver.

The solution is to translate the `git describe` string to faux-semver so
it can be safely compared with the version reported from the server.

Fixes this case:

    A new release of gh is available: v1.4.0-41-g2f9e4cb1 → v1.4.0
    https://github.com/cli/cli/releases/tag/v1.4.0
2021-01-20 16:13:50 +01:00
Mislav Marohnić
75ebb863e3 Use testify assertions for error matching 2021-01-19 13:59:37 +01:00
Cristian Dominguez
45f4a1f087 Equal: flip arguments position 2021-01-18 21:00:59 -03:00
Mislav Marohnić
c308f1cd91 Prevent further use of SetPrepareCmd and InitCmdStubber 2021-01-18 22:44:53 +01:00
Cristian Dominguez
3afb1d0b1a Use Testify assertions in test 2021-01-16 19:19:30 -03:00
Cristian Dominguez
ce151420f3 Migrate legacy tests 2021-01-11 21:07:19 -03:00
Mislav Marohnić
536a173364 Enable debugging HTTP traffic during auth login/refresh 2021-01-05 16:24:47 +01:00
Mislav Marohnić
9140e88708 Extract oauth package 2020-12-18 20:27:56 +01:00
Mislav Marohnić
d81b2927a5
Merge pull request #2488 from cristiand391/new-release-notification
Notify new releases only once per day
2020-12-15 16:15:01 +01:00
Mislav Marohnić
2843ffff23 Classify the update package as internal 2020-12-15 16:09:08 +01:00
Mislav Marohnić
ada59236c6 Add workflow to the list of default OAuth scopes we request
Since GitHub CLI now offers to authenticate your Git as well, the token
we request here will be used for git pushes. Since we do anticipate our
users making edits to their GitHub Actions workflow files, we want them
to be able to push their changes, and this scope allows that.
2020-12-07 20:12:58 +01:00
Mislav Marohnić
bc81282a6c Merge remote-tracking branch 'origin' into git-credentials 2020-12-07 20:02:08 +01:00
Sam Coe
e21c5100fa
Properly check env auth tokens in CheckAuth 2020-12-01 11:44:14 -05:00
Mislav Marohnić
d56d92c908 If git credential helper is non-defined, set gh as credential helper 2020-11-23 20:20:05 +01:00
Josh Soref
a66a65d422 spelling: unmatched 2020-11-21 21:43:51 -05:00
Josh Soref
c8b9486fd3 spelling: nonexistent 2020-11-21 21:43:51 -05:00
Josh Soref
8ba68fc68a spelling: deprecated 2020-11-21 21:43:51 -05:00
Sam Coe
2eb40f8a14
Empty auth token env variables are equal to being unset 2020-11-12 10:09:08 +03:00
Sam Coe
414de332fb
cleanup 2020-11-12 09:52:14 +03:00
Sam Coe
a79a0bbfd7
Add support for GH_TOKEN and GH_ENTERPRISE_TOKEN 2020-11-12 09:52:10 +03:00
Mislav Marohnić
6e1e62f496 Consistently print commands in DEBUG mode 2020-11-11 18:17:01 +01:00
Mislav Marohnić
97b176da93 Fix git executable name for Windows in tests 2020-11-11 16:46:49 +01:00
Mislav Marohnić
c87dc00f38 Omit the full path of a command in DEBUG mode 2020-11-11 16:33:13 +01:00
Mislav Marohnić
5b4a08dcb9 Ensure that only PATH is searched when shelling out to external commands
Works around https://github.com/golang/go/issues/38736 for Windows.
2020-11-11 16:33:13 +01:00
Sam Coe
86906c6769
Small cleanup 2020-11-04 12:40:40 +03:00
Sam Coe
241e90aa9b
Make markdown:generate annotation a markdown generation override for hidden commands 2020-11-04 12:35:58 +03:00
Sam Coe
f770c6481c
Generate markdown for help topics 2020-11-04 12:35:58 +03:00
Nate Smith
441f40b427
Merge pull request #2319 from cli/cleanup-duplicate-config
Refactor config command to improve testability
2020-11-03 12:54:16 -06:00
Nate Smith
24d863eccc
Merge pull request #2316 from cli/colors-1624
migrate off of utils color functions
2020-11-03 12:49:02 -06:00
Sam Coe
ce18b943b8
Export type ConfigOption and group InvalidValueError code 2020-11-03 09:49:05 +03:00
Sam Coe
5c5f52c4c4
Refactor config command 2020-11-03 09:49:05 +03:00
Sam Coe
e6be06f737
Cleanup duplicate config options 2020-11-03 09:49:05 +03:00
vilmibm
893fe09a83 try passing iostreams around instead of writer+colorscheme 2020-11-02 11:44:50 -08:00
Nate Smith
325cc3c078
Merge pull request #2256 from cli/internalize-docs
Internalize doc generation code
2020-11-02 12:31:37 -06:00
vilmibm
a2aa154794 port entirely to ColorScheme 2020-10-29 12:37:45 -07:00
Mislav Marohnić
ae7d42a876 Centralize all known configuration options 2020-10-26 14:42:04 +01:00
Sam Coe
52959abee1
Clean up and refactor unused doc generation code 2020-10-23 08:14:36 +02:00
Sam
f8ce68f062
Remove SEE ALSO from markdown docs generation 2020-10-22 12:59:11 +02:00
Sam
699c9ae131
Remove Cobra autogenerated string from docs generation 2020-10-22 12:59:11 +02:00
Sam
36949e263a Internalize doc generation from Cobra 2020-10-22 09:38:51 +00:00
Sam
d7d5a6b753
Merge pull request #2247 from cli/refactor-command-root
Change command package to be build package
2020-10-22 10:50:15 +02:00
Mislav Marohnić
460d55f723 Move HostnameValidator to ghinstance 2020-10-21 16:31:20 +00:00
Shrihan Kumar Padhy
f31e49fdff
Add a new config validation key called prompt (#2246) 2020-10-21 16:56:25 +02:00
Sam Coe
f0b534f92e
Move build to internal 2020-10-21 13:31:32 +02:00
Mislav Marohnić
14a222bade Let the receiver choose how to format the cfg.Set() value error 2020-10-16 18:54:36 +00:00