Commit graph

57 commits

Author SHA1 Message Date
vilmibm
1831d95433 isolated clone command
This commit hacks the existing repo clone tests into something usable by
the new isolated command. It went ok and was less effort than trying to
introduce the same kind of test format as repo view and gist create.
2020-07-23 16:40:31 -05:00
vilmibm
dc02366128 move generateRepoURL to ghrepo 2020-07-23 11:16:47 -05:00
Mislav Marohnić
87a9dc8d4b Merge remote-tracking branch 'origin' into ghe-remotes 2020-07-13 13:39:14 +02:00
Mislav Marohnić
b30cf15094
Merge pull request #1295 from cli/path-error
Raise more informative path error when reading config file
2020-07-10 13:25:34 +02:00
Mislav Marohnić
446a4111f7 Respect hostnames when resolving git remotes and URL args to repos 2020-07-02 20:36:10 +02:00
Mislav Marohnić
569645a050 Support hosts.yml existing while config.yml does not
After a person copies `hosts.yml` to a headless system, they will still
be forced to go through re-authentication flow unless they copy or
initialize a `config.yml` as well. This fixes respecting authentication
info from `hosts.yml` even if `config.yml` is missing.
2020-07-01 14:34:44 +02:00
Mislav Marohnić
4827ffbf03 Raise more informative path error when reading config file
Example:

    remove or rename regular file `/home/foo/.config/gh` (must be a directory)
2020-06-30 13:47:15 +02:00
Mislav Marohnić
3ea71e6eb6 Add ability to parse non-GitHub.com git remotes 2020-06-23 19:51:26 +02:00
vilmibm
64a7fd4200 test default configuration 2020-06-11 14:04:41 -05:00
vilmibm
47102fe427 just fill in the blank config with default content 2020-06-11 14:04:29 -05:00
vilmibm
cabf0b1972 populate initial config 2020-06-10 17:08:12 -05:00
vilmibm
8963d80942 better get func 2020-06-05 13:09:04 -05:00
vilmibm
6bd898ee54 start on alias delete 2020-06-05 13:04:45 -05:00
vilmibm
106a0957e1 review feedback 2020-06-05 12:24:54 -05:00
vilmibm
a05daf2145 gh alias list 2020-06-05 12:06:51 -05:00
Mislav Marohnić
9a5b628001 Ensure consistent order of yaml keys in migrateConfig 2020-06-04 12:22:26 +02:00
Mislav Marohnić
1f616859fc Merge remote-tracking branch 'origin' into auth-split 2020-06-04 12:00:19 +02:00
Mislav Marohnić
5b872e7397 Rename fn to filename across the config package 2020-06-03 13:50:18 +02:00
Mislav Marohnić
c1a518ef8e Un-export AuthFlow 2020-06-03 13:43:54 +02:00
vilmibm
1b844d2cc0 not needed in public interface 2020-06-02 13:50:19 -05:00
vilmibm
54183f4c6e remove a gross type hack 2020-06-02 11:26:44 -05:00
vilmibm
52a02a7a4b todo 2020-06-02 11:26:44 -05:00
vilmibm
37761c97fa partial cleanup 2020-06-02 11:26:44 -05:00
vilmibm
7b4c0c57b8 WIP: handle empty aliases key 2020-06-02 11:26:44 -05:00
vilmibm
09fa75e141 implement gh alias set 2020-06-02 11:26:44 -05:00
Mislav Marohnić
8e70fe939d 🔥 unused constant 2020-06-02 15:39:56 +02:00
Mislav Marohnić
c08d4f0697 Write all per-host config entries to hosts.yml
Read from and write to the `hosts.yml` file every time `config.yml` is
accessed. Everything that before went under the `hosts:` map now belongs
to `hosts.yml`.
2020-06-02 15:35:13 +02:00
Mislav Marohnić
bad138e448 Enable reading from and writing to empty config files 2020-06-02 13:24:46 +02:00
Mislav Marohnić
d6f58fb448 🔥 hosts optimization
We dynamically add hosts on `Set`, so this `hosts` cache might fall out
of date. We could ensure to keep it updated, but I'm not convinced it's
necessary for speed right now.
2020-06-02 13:24:46 +02:00
Mislav Marohnić
77227a6c50 Trigger OAuth flow only when requesting auth token
Previously we would trigger OAuth flow when the config file did not
exist. Now we will let an empty Config object be initialized in that
case, but trigger OAuth flow when the Context caller requests an
AuthToken.
2020-06-02 13:24:39 +02:00
Mislav Marohnić
fd7b87f3fa Allow writing host-specific keys in a blank config 2020-06-02 13:23:03 +02:00
Mislav Marohnić
f42c9d4b2d Allow stubbing multiple config files 2020-06-02 13:19:21 +02:00
Mislav Marohnić
43a8b311bc Un-publish Hosts from the Config interface
It's not being depended on anywhere right now, so this minimizes the
public interface.
2020-06-02 13:19:21 +02:00
Mislav Marohnić
c71dcd3441
Merge pull request #1013 from cli/auth-complete-fix
Fix showing "Authentication complete" notice after OAuth dance
2020-06-02 10:35:07 +02:00
Mislav Marohnić
eab5af9449 Merge remote-tracking branch 'origin' into cobra1.0 2020-05-28 15:15:20 +02:00
Mislav Marohnić
0d7177f8d1 Fix showing "Authentication complete" notice after OAuth dance
This was an accidental casualty of refactoring in
3aaa231cc5
2020-05-27 14:43:04 +02:00
Mislav Marohnić
ab0e43c6c8 Merge remote-tracking branch 'origin/master' into auth-from-env 2020-05-27 11:44:19 +02:00
Mislav Marohnić
a33c00d389 Merge remote-tracking branch 'origin/master' into cobra1.0 2020-05-22 18:21:35 +02:00
vilmibm
509be34af6 Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-20 17:08:31 -05:00
Mislav Marohnić
767521c055 Stop providing AuthLogin from context
The login name of the authenticated user will be readily available only
if authentication info comes from the config file. With other upcoming
authentication modes (for example, the GITHUB_TOKEN environment
variable), the token is the only piece of information we got, so we
would need to additionally query for the login name.

Since `issue status` and `pr status` are the only commands that need the
name of the authenticated user right now, have those commands explicitly
query for the login name. This results in an additional API query, but
simplifies Context implementation and future authentication approaches.
2020-05-20 17:09:13 +02:00
Kevin Bluer
d440a95aed
Improved error message when "owner/repo" format not provided (#919)
Fixes #882
2020-05-18 11:13:48 +02:00
vilmibm
ed1a3a60fd Merge remote-tracking branch 'origin/master' into wingkwong/master 2020-05-13 13:43:09 -05:00
Mislav Marohnić
ab4c6e2ad0 Remove obsolete hack to generate fish completions 2020-05-13 12:51:55 +02: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ć
8ed9a0324e Merge remote-tracking branch 'origin/master' into oauth-read-org 2020-04-23 15:35:35 +02:00
vilmibm
6e55e899fa handle defaults at the Config level instead of ConfigMap 2020-04-21 10:59:44 -05:00
vilmibm
bba63439dc slopwip for defaults 2020-04-21 10:32:57 -05:00
vilmibm
c4693077aa move config stuff to its own package 2020-04-20 13:57:16 -05:00
vilmibm
44acdd4ec3 Merge branch 'master' into pr-status-no-commits 2020-03-30 12:04:02 -05:00
Mislav Marohnić
894899c71d Add code docs for ghrepo package 2020-03-27 14:01:44 +01:00