haskell / ghcup-hs

https://www.haskell.org/ghcup/
GNU Lesser General Public License v3.0
284 stars 88 forks source link

Easier selection of known release channels #1050

Open hasufell opened 5 months ago

hasufell commented 5 months ago
  1. ask during bootstrap script which release channels should be activated
  2. maybe have aliases for known release channels, so that the user can do ghcup config add-release-channel prereleases
    • where should the mapping exist? In ghcup code, another yaml or in one of the "base" yamls?
  3. Support selecting/managing release channels via the TUI

@lsmor

lsmor commented 5 months ago

About the first two points.... I got no idea. About this:

3. Support selecting/managing release channels via the TUI

Surely we can a new button in the contex menu, with "Add release channel" and something like this

|--------------- Add New Channel -----------------|
|                                                 |
| From known Channels: ◦ nightlies                |
|                      ◉ prereleases              |
|                      ◦ latest                   |
|                                                 |
| From URL:  [ Enter your URL here           ]    |
|---------------- Add New Channel ----------------|
dfordivam commented 2 weeks ago
  • ask during bootstrap script which release channels should be activated

In interactive mode we can add support for this, in both unix and win.

        warn "Do you want to enable other release channels?"
        warn "The following release channels can be enabled during installation"
        warn "cross, nightlies, prereleases, and vanilla"
        warn ""
        warn "[Y] Yes  [N] No  [?] Help (default is \"N\")."
        warn ""

Then loop and ask for each channel Y/N, giving brief info about each and their URL. We can limit this to cross, prereleases, and vanilla only (ie not include nightlies here)

Other ways of getting inputs may be more complicated than this.

  • maybe have aliases for known release channels, so that the user can do ghcup config add-release-channel prereleases

    • where should the mapping exist? In ghcup code, another yaml or in one of the "base" yamls?

Aliases can be added in ghcup code

  • Support selecting/managing release channels via the TUI

We can add a Context Menu for GHCup, which allows various config related changes, including channel selection.

The context menu can be opened by moving focus on any "GHCup" row and pressing "Enter" In TUI the GHCup row is always shown, even in case of an empty metadata file.

Currently "Install" menu is shown in GHCup, we can add more things to it gradually.

There should be checkboxes for each of the channels; on "Save" the config will be updated. There could be an additional Text input field (via popup) which allows adding custom URLs

 ┌─────────────────────────────────────────Context Menu for GHCup 0.1.30.0────────────────────────────────────────┐
 │┌───────┐                                                                                                       │
 ││Install│        Advance Installation Settings                                                                  │
 │└───────┘                                                                                                       │
 │┌──────────┐                                                                                                    │
 ││Configure │     Release Channels                                                                               │
 │└──────────┘                                                                                                    │
 │                                                                                                                │
 │Press q to go back                                                                                              │
 └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
 ┌────────────────────────────────────────Configure Release Channels──────────────────────────────────────────────┐
 │┌──────────────────┐                                                                                            │
 ││Save Configuration│ Save configuration, and enable below release channels                                      │
 │└──────────────────┘                                                                                            │
 │─────────────────────────────────────────────────────── o ──────────────────────────────────────────────────────│
 │Main (default) [  ✓  ]                                                                                          │
 │       Vanilla [  ✗  ] Similar to Main, but only uses upstream bindists (no patches/fixes are applied,          │
 │                       no missing platforms added). Maintained by the upstream developers                       │
 │         Cross [  ✗  ] Contains experimental cross compilers                                                    │
 │   Prereleases [  ✗  ] Contains pre-releases of all tools                                                       │
 │     Nightlies [  ✗  ] contains ghc nightlies                                                                   │
 │        Custom │ file:///my-custom-metadata.yaml                                                              │ │
 │        Custom │Press enter to add a Custom URL to a release channel                                          │ │
 │                                                                                                                │
 │Press q to go back, Press Enter to edit the highlighted field                                                   │
 └────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

We can show error if no metadata is selected.