Commit graph

406 commits

Author SHA1 Message Date
Andrew Feller
a55f50b115 Remove Extension.FullName() from interface
- this was something I did in the original implementation of this improved extension update notification logic
- discovering other parts of the extension manager code that were working with non-prefixed extension names motivated a different approach
- the extension manager code that requires the extension be prefixed has been enhanced to use the centralized ensurePrefixed() logic, making the need for this on the extension unnecessary
2024-12-08 20:01:26 -05:00
William Martin
d7465bdf3c Initial testscript introduction 2024-10-11 16:31:16 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
cceec8e0d0 Remove redundant error on migration failure 2023-12-11 16:25:20 +01:00
Sam Coe
eb771aecc9 Address PR comments 2023-12-06 14:06:28 +01:00
Sam Coe
d2ff55737c Enable multi-account migration 2023-12-06 14:06:28 +01:00
William Martin
9efa7248a9 Initial multi-account migration work 2023-12-06 14:06:28 +01:00
Mikel Olasagasti Uranga
46a7042b88
Bump cpuguy83/go-md2man from 2.0.1 to 2.0.3 (#8209)
Version 2.0.3 introduces a fix in PR
https://github.com/cpuguy83/go-md2man/pull/105 that breaks a test for
gen-doc, thus requires a small change in the test.
2023-10-18 07:17:20 +00:00
Raj Hawaldar
9fc571499f
pr checks return distinct exit code for PENDING checks (#7866) 2023-08-25 10:30:45 -07:00
Sam Coe
9be9dc22e9
Fix error handling for extension and shell alias commands (#7567) 2023-06-20 08:41:02 +09:00
Sam Coe
1c3c402377
Do not generate docs for aliases (#7497) 2023-05-28 00:27:31 +00:00
Sam Coe
74ee8cacae
Allow creating of nested aliases (#7457) 2023-05-25 09:46:45 +09:00
Rick Kilgore
0d110ea8bf
survey: fix color contrast of default values in prompts (#7354) 2023-05-15 11:47:53 +02:00
Mislav Marohnić
626c639df5
Disallow update checker delaying the gh process (#6978)
This ensures that checking for newer versions of gh happens in the background of the main operation that the user requested, and that when that operation is completed, the gh process should immediately exit without being delayed by the update checker goroutine.
2023-02-07 19:52:53 +00:00
Mislav Marohnić
9ec2107cc6
Merge pull request #6421 from cli/go-gh-term
Dogfood term package from go-gh
2022-11-03 13:02:24 +01:00
Josh Soref
6530c8fa1b Replace secrets.GITHUB_TOKEN with github.token 2022-11-01 10:59:17 -04:00
Mislav Marohnić
38d465b1da
Merge remote-tracking branch 'origin' into go-gh-term 2022-10-31 15:33:24 +01:00
dojutsu-user
d0955ee077 disable colors in ansi 2022-10-25 22:57:00 +05:30
Mislav Marohnić
25a926d5cb
Dogfood term package from go-gh 2022-10-11 14:29:50 +02:00
Sam Coe
e7102f9d84
Migrate to go-gh text package (#6236) 2022-09-14 09:23:55 +04:00
Mat Schaffer
fd01d3f1e9
Remove brew update instructin
Homebrew seems to auto-update by default now.
2022-08-17 09:46:35 +09:00
Sam Coe
e5cf302ad8
Post go-gh integration cleanup (#5933) 2022-07-13 14:58:50 +02:00
Sam Coe
cacff4ad6d
Use go-gh config package (#5771) 2022-06-23 11:50:04 +00:00
Sam Coe
074ed50b8a
Integrate go-gh API package (#5614) 2022-06-23 04:05:31 +01:00
Spenser Black
5771fcb35e
Print auth help message based on environment (#5781)
This will check if `gh` is running in a CI environment. If so, it will
suggest using environment variables to set the auth token. Additionally,
if the CI environment is detected to be GitHub Actions, it will provide
some example code. If it is not a CI environment, it will print the
standard help message.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-06-14 12:27:11 +00:00
Mislav Marohnić
82ac154d56 Consistent version format in version upgrade notice
We can strip the "v" prefix where it's unambiguous that we're talking
about version numbers.

Before:

    A new release of gh is available: 2.8.0 => v2.9.0

After:

    A new release of gh is available: 2.8.0 => 2.9.0
2022-05-02 13:29:10 +02:00
Roshan Padaki
7a3d02df47
Add autocomplete descriptions for aliases and extensions (#5447) 2022-04-26 13:08:16 +02:00
Håvard Anda Estensen
58cb773e09
Replace ioutil with io and os (#5498) 2022-04-26 13:07:44 +02:00
Roshan Padaki
13342cb272
Don't error on list commands when no results found (#5479)
Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-04-25 17:55:52 +00:00
Sam Coe
2c0236d096
Add extension upgrade --dry-run (#5098) 2022-04-12 07:18:08 +00:00
lylecantcode
56fda0f8c6
Support GH_DEBUG to control verbosity, deprecate DEBUG (#5306)
The GH_DEBUG environment variable is a new gh-specific verbosity control.

For backwards-compatibility, DEBUG will still be respected if it has values
"1", "true", "yes", and "api", but any other values will be ignored.

Finally, support for "oauth" debug value has been dropped in favor of "api".
The "oauth" value only had limited, internal use.

Co-authored-by: Mislav Marohnić <mislav@github.com>
2022-03-29 18:05:35 +02:00
Mislav Marohnić
0a5e220231 Ignore EPIPE errors when writing to a closed pager
While a gh command is writing stdout to a pager, the user may choose to
close the pager program before the pager has read all the data on its
standard input. In that case, the parent gh process will receive an
EPIPE error, which would bubble up its error handling and cause it to
print something like:

    write |1: broken pipe

Since this was caused by an explicit user action of closing the pager,
and since the user probably doesn't want to see this uninformative
error, this informs our global error handling of this error and causes
it to be ignored.
2022-02-10 16:42:00 +01:00
Audree Steinberg
1ec2c0807e
Add new line after error (#5124)
* Add new line

* Fix syntax for adding new line

* Add `\n` to another error
2022-02-01 08:35:46 +01:00
Mislav Marohnić
66c18b40f2
Handle SAML enforcement challenge from the server (#5054)
Whenever a SSO challenge gets issued by the server by means of a URL in
the `X-GitHub-SSO` response header, gh now additionally prints that URL
on the standard error stream.

This is achieved by installing a middleware to all HTTP requests and
storing the server challenge to a value accessible by `factory.SSOURL()`.
Such approach was made necessary mainly because of the
`shurcool-graphql` client which doesn't give access to response headers
when a GraphQL error case is encountered.
2022-01-19 14:22:22 +01:00
Mislav Marohnić
31c7181297 Refresh man pages
- Fix name of man pages for all but the toplevel command
- Set title of all man pages to "GitHub CLI manual"
- Include gh version information in man pages
- Clean up rendering of flags section
- List subcommands for every command
2021-12-20 18:11:31 +01:00
Alan Donovan
f4491c7a80 Add FlagErrorf; encapsulate FlagError.error 2021-10-21 11:40:20 -04:00
Mislav Marohnić
2ca18e0600 Warn about missing OAuth scopes when reporting HTTP 4xx errors
If a 4xx server response lists scopes in the X-Accepted-Oauth-Scopes
header that are not present in the X-Oauth-Scopes header, the final
error messaging on stderr will now include a hint for the user that they
might need to request the additional scope:

    $ gh codespace list
    error getting codespaces: HTTP 403: Must have admin rights to Repository. (https://api.github.com/user/codespaces?per_page=30)
    This API operation needs the "codespace" scope. To request it, run:  gh auth refresh -h github.com -s codespace
2021-10-13 23:24:14 +02:00
Jose Garcia
9e6c11e767 Move cmd/ghcs to pkg/cmd/codespace
- Delete pkg/cmd/codespace/main as it is no longer needed in this
  codebase
2021-09-30 11:20:13 -04:00
Mislav Marohnić
48bac0abd2 Fix race in codespaces delete test 2021-09-29 16:40:40 +02:00
Jose Garcia
a0f11b6664 Handle concurrency in tests and logger
- Live Share tests
- Logger implementation for ghcs
2021-09-29 16:40:40 +02:00
Mislav Marohnić
f749590e87 Replace old "github/ghcs" import statements 2021-09-28 16:57:56 +02:00
Mislav Marohnić
e64607d07b Merge remote-tracking branch 'ghcs/main' into import-codespaces
Co-authored-by: Jose Garcia <josebalius@github.com>
2021-09-28 16:46:27 +02:00
Mislav Marohnić
f947ef3448 Remove lightstep configuration
The `github.com/shirou/gopsutil` dependency of lightstep-tracer is
giving us trouble during building.

Ref. https://github.com/shirou/gopsutil/issues/976

Another build problem raises its head even after we upgrade gopsutil to
a version where the above bug is fixed.
2021-09-28 16:42:35 +02:00
Mislav Marohnić
c82d4c5472 Avoid passing params struct as pointer 2021-09-24 17:36:18 +02:00
Mislav Marohnić
dc8f6ef183 No longer accept a logger in CreateCodespace
The API layer shouldn't concern itself with logging progress to stderr.
Instead, we will subsequently add progress indicators in the caller
around CreateCodespace and other potentially slow commands as needed.
2021-09-24 17:30:31 +02:00
Mislav Marohnić
ca0f89d3bc Introduce an App struct that executes core business logic
The Cobra commands are now a light wrapper around the App struct.

Co-authored-by: Jose Garcia <josebalius@github.com>
2021-09-24 17:20:34 +02:00
Mislav Marohnić
8807b3a73a Merge pull request #184 from github/args-constraint
Consistently institute constraints for position arguments and improve error message
2021-09-24 16:02:36 +02:00
Mislav Marohnić
92d0abd6ab Merge pull request #79 from github/raffo/delete-codespaces
Add code and command to delete unused codespaces
2021-09-24 16:02:05 +02:00
Mislav Marohnić
3d017b2824 Fix stderr output on delete errors 2021-09-24 15:09:41 +02:00
Mislav Marohnić
d853ce5bc9 Avoid resolving executable() until requested at runtime
This is to avoid hitting the filesystem and resolving symlinks
unnecessarily. The value of executable is just used conditionally by a
handful of commands.
2021-09-24 14:42:41 +02:00