Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ulfjack
Copy link
Contributor

@ulfjack ulfjack commented Mar 6, 2023

Fixes #5500.

@ulfjack ulfjack requested a review from a team as a code owner March 6, 2023 21:44
@ulfjack ulfjack requested review from mislav and removed request for a team March 6, 2023 21:44
@cliAutomation cliAutomation added the external pull request originating outside of the CLI core team label Mar 6, 2023
}

fmt.Fprintf(w, "%s to open %s in your browser... ", cs.Bold("Press Enter"), oauthHost)
fmt.Fprintf(w, "%s to open %s in your browser... ", cs.Bold("Press Enter"), authURL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will probably work to print the URL, but we don't want to print the full URL if our tool is also going to attempt to open the URL ourselves, since that could be confusing to the user (should they open the printed URL, or press Enter? some will do both). Instead, per my comment in the original issue #5500 (comment), if the user intends to open the URL manually themselves, they should indicate so in the gh auth login interactive prompt, which should then print the URL and not offer the functionality to press Enter to have gh open it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, and I'm not planning to work on your suggestion for that reason. Even if people are confused by this, doing it twice is still fine. Compared to that, asking people another multi-choice question is worse and adds unnecessary complexity. The third option of not changing it at all means that some use cases are dropped on the floor, and the affected users can't login and have to find a workaround to use your CLI at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For precedence, see aws sso login or gcloud auth login. Btw. both of those work for me out of the box.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mislav Asking the user to specify they will open the URL manually is poor UX. Just let the user decide. Tell them you'll open the browser for them, but just in case that doesn't work, here is the URL.

End of story.

If people can figure out how to use git then they can figure out what to do with a link on a screen.

@mislav
Copy link
Contributor

mislav commented Apr 25, 2023

We're disagreeing with the approach, so I am closing this in favor of a future PR that implements the interactive option outlined in #5500 (comment). Thank you for the contribution!

@williammartin
Copy link
Member

I'm reopening this after discussion with @BagToad about the original issue. None of the original maintainers are still around that rejected this initially and we think it should be merged.

As far as we're concerned this is:

  1. Not a full solution to the UX around failing to open a browser
  2. An almost pure net-positive for many people.
  3. Not likely to cause confusion any more than the current prompt
  4. Easy to change in future because it's part of our interactive flows
  5. Better than allowing the previous proposal to add another prompt option to linger anymore
➜  ./bin/gh auth login
? Where do you use GitHub? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? How would you like to authenticate GitHub CLI? Login with a web browser

! First copy your one-time code: XXXX-YYYY
Press Enter to open https://github.com/login/device in your browser...

Copy link
Contributor

@jtmcg jtmcg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally agree, @williammartin and @BagToad. Let's :shipit:

@BagToad BagToad merged commit d645fd4 into cli:trunk Oct 3, 2024
@ulfjack
Copy link
Contributor Author

ulfjack commented Oct 5, 2024

\o/

@ulfjack ulfjack deleted the patch-1 branch October 5, 2024 12:04
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Oct 17, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [cli/cli](https://github.com/cli/cli) | minor | `v2.58.0` -> `v2.59.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>cli/cli (cli/cli)</summary>

### [`v2.59.0`](https://github.com/cli/cli/releases/tag/v2.59.0): GitHub CLI 2.59.0

[Compare Source](cli/cli@v2.58.0...v2.59.0)

#### What's Changed

-   Allow community submitted design work by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#9683
-   Improve `SECURITY.md` with expectations for privately reported vulnerabilities by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#9687
-   Emit a log message when extension installation falls back to a `darwin-amd64` binary on an Apple Silicon macOS device by [@&#8203;timrogers](https://github.com/timrogers) in cli/cli#9650
-   Print the login URL even when opening a browser by [@&#8203;ulfjack](https://github.com/ulfjack) in cli/cli#7091
-   configurable maxwidth for markdown WithWrap() by [@&#8203;smemsh](https://github.com/smemsh) in cli/cli#9626
-   Handle errors when parsing hostname in auth flow by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#9729
-   Add `repo license list/view` and `repo gitignore list/view` by [@&#8203;BagToad](https://github.com/BagToad) in cli/cli#9721
-   Introduce testscript acceptance tests generally, and for the MR command specifically by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#9745
-   Support `GH_ACCEPTANCE_SCRIPT` env var to target a single script by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#9756
-   Ensure Acceptance defer failures are debuggable by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#9754
-   Add acceptance task to makefile by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#9748
-   Add Acceptance tests for `issue` command by [@&#8203;williammartin](https://github.com/williammartin) in cli/cli#9757
-   Update IsEnterprise and IsTenancy for orthogonality using go-gh by [@&#8203;jtmcg](https://github.com/jtmcg) in cli/cli#9755
-   Supporting filtering on `gist list` by [@&#8203;heaths](https://github.com/heaths) in cli/cli#9728

#### New Contributors

-   [@&#8203;ulfjack](https://github.com/ulfjack) made their first contribution in cli/cli#7091
-   [@&#8203;smemsh](https://github.com/smemsh) made their first contribution in cli/cli#9626

**Full Changelog**: cli/cli@v2.58.0...v2.59.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Login with a web browser on headless machine

7 participants