Commit graph

127 commits

Author SHA1 Message Date
William Martin
d7465bdf3c Initial testscript introduction 2024-10-11 16:31:16 +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
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
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
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ć
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
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
Mislav Marohnić
8f3b6749d7
Merge pull request #4241 from cli/saml-error
Suggest to re-authenticate to fix "SAML enforcement" error
2021-09-03 16:10:16 +02:00
Mislav Marohnić
b0b67014f1 Suggest to re-authenticate to fix "SAML enforcement" error
As far as I can put together, this error appears when someone has
authenticated GitHub CLI with a PAT that isn't authorized to access a
certain org. It can also happen if someone has authorized GitHub CLI
using the legacy "GitHub CLI (dev)" OAuth app instead of our production
OAuth app.

Doing `gh auth refresh` will re-authenticate the user using our
production "GitHub CLI" OAuth app which will not have problems accessing
resources in different GitHub organizations.
2021-08-30 17:18:59 +02:00
Mislav Marohnić
11fbb60ae7 Rename the module to "github.com/cli/cli/v2" 2021-08-25 12:41:30 +02:00
Mislav Marohnić
af2aecd40b
Merge pull request #4146 from cli/force-tty
Add ability to force terminal-style output even when redirected
2021-08-23 16:46:14 +02:00
Mislav Marohnić
8129fb3d3e
Merge pull request #4171 from mahdyar/chore/make-gh-status-clickable
chore: make gh status link clickable
2021-08-23 13:12:35 +02:00
Mahdyar Hasanpour
db74830e64
chore: make gh status clickable
Adding https:// to githubstatus.com to make it clickable on terminal emulators
2021-08-22 18:01:55 +04:30
Mislav Marohnić
51d609078b Enable gh help <command> for extensions
This sends the `--help` flag to the extension. The extension is
reponsible for printing something useful as a result.
2021-08-19 20:38:19 +02:00
Mislav Marohnić
321fd98f82 Add ability to force terminal-style output even when redirected 2021-08-17 20:12:25 +02:00
Mislav Marohnić
0d999ddaa1 Rework local extensions for Windows
Replace the implementation that relied on symlinks with the one that
create regular files that act like symlinks: they contain a reference to
the local directory where to find the extension.
2021-07-28 22:47:54 +02:00
Sam
33c3fb5cdd
Merge pull request #3870 from cli/extensions-revisited
Improvements to gh extensions
2021-06-28 17:12:29 -07:00
Mislav Marohnić
1ec47d8191 Improvements to gh extensions
- Extensions on Windows now enabled through the `sh.exe` interpreter
- `sh.exe` now found on Windows when git was installed via scoop
- `gh extensions list` command shows origin repo for the extension
- `gh extensions upgrade --all` is required to upgrade all extensions
- Added `gh extensions remove`
- Shell completions now include aliases and extension names
- `gh` help output now lists available extension names
- Extensions are stored to XDG_DATA_HOME
2021-06-21 16:54:08 +02:00
Mislav Marohnić
8ff42bf28c Fix repo override 2021-06-17 17:58:46 +02:00
Mislav Marohnić
8dd1e12f64 Merge remote-tracking branch 'origin' into fix-actions-help 2021-06-17 16:13:34 +02:00
Mislav Marohnić
883943946a Add a global pre-run hook to handle auth check and repo override
With auth check being done via Cobra hooks, it is automatically skipped
for non-runnable commands and `-h/--help` flag usage.
2021-06-17 16:01:57 +02:00
chemotaxis
1e3bba5ff6 Add comment about cmd.Help()
The linter picked up that the error value from cmd.Help() isn't checked.

Even though cmd.Help() returns an error value, it's always nil. The
inner HelpFunc() function directly prints the error message instead of
returning an error value.
2021-06-16 22:28:41 -04:00
chemotaxis
558ff2dff0 Skip authentication message if asking for help
Currently, this still checks authentication, but we skip the
authentication message and exit normally.
2021-06-16 14:25:08 -04:00
chemotaxis
c903f1ecd0 Ask for and print help even if logged out
You have to explicitly ask for help using the help flags.  Otherwise,
`gh` will just print the authentication message.
2021-06-16 01:18:52 -04:00
Sam Coe
edfac42384
Set up iostreams in factory default 2021-06-15 09:20:00 -04:00
Cristian Dominguez
b3c2318e09 Increase GH_PAGER precedence
If `GH_PAGER` is exists, set it as the pager even if one is
already set in config.

This allows a user to change/disable the pager per single invocation.
2021-06-04 23:22:37 -03:00