Merge pull request #27 from satisfactorymodding/command-help-enter

chore: add 'enter to select' to all scenes
This commit is contained in:
Rob B 2023-07-07 03:01:01 -05:00 committed by GitHub
commit 774d0c40ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 62 additions and 0 deletions

View file

@ -60,6 +60,7 @@ Download the "all" build [here](https://github.com/Vilsol/ficsit-cli/releases/la
## Troubleshooting
* Config files are located in `%APPDATA%\ficsit\`
* Cached downloads are located at `%LOCALAPPDATA%\ficsit\downloadCache`
## Development

View file

@ -4,6 +4,7 @@ import (
"fmt"
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@ -67,6 +68,11 @@ func NewInstallation(root components.RootModel, parent tea.Model, installationDa
model.list.SetSize(model.list.Width(), model.list.Height())
model.list.StatusMessageLifetime = time.Second * 3
model.list.KeyMap.Quit.SetHelp("q", "back")
model.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
return model
}

View file

@ -33,6 +33,7 @@ func NewInstallations(root components.RootModel, parent tea.Model) tea.Model {
l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "new installation")),
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}

View file

@ -52,6 +52,7 @@ func NewNewInstallation(root components.RootModel, parent tea.Model) tea.Model {
l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys(keys.KeyTab), key.WithHelp(keys.KeyTab, "select")),
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "continue")),
}
}

View file

@ -4,6 +4,7 @@ import (
"strings"
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@ -132,6 +133,11 @@ func NewMainMenu(root components.RootModel) tea.Model {
model.list.SetFilteringEnabled(false)
model.list.Title = "Main Menu"
model.list.Styles = utils.ListStyles
model.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
return model
}

View file

@ -5,6 +5,7 @@ import (
"sort"
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
@ -43,6 +44,11 @@ func NewInstalledMods(root components.RootModel, parent tea.Model) tea.Model {
l.Styles = utils.ListStyles
l.SetSize(l.Width(), l.Height())
l.KeyMap.Quit.SetHelp("q", "back")
l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
m := &installedModsList{
root: root,

View file

@ -3,6 +3,7 @@ package mods
import (
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@ -104,6 +105,11 @@ func NewModMenu(root components.RootModel, parent tea.Model, mod utils.Mod) tea.
model.list.SetSize(model.list.Width(), model.list.Height())
model.list.StatusMessageLifetime = time.Second * 3
model.list.KeyMap.Quit.SetHelp("q", "back")
model.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
return model
}

View file

@ -3,6 +3,7 @@ package mods
import (
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@ -70,6 +71,11 @@ func NewModVersion(root components.RootModel, parent tea.Model, mod utils.Mod) t
model.list.SetSize(model.list.Width(), model.list.Height())
model.list.StatusMessageLifetime = time.Second * 3
model.list.KeyMap.Quit.SetHelp("q", "back")
model.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
return model
}

View file

@ -72,6 +72,7 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
return []key.Binding{
key.NewBinding(key.WithKeys("s"), key.WithHelp("s", "sort")),
key.NewBinding(key.WithKeys("o"), key.WithHelp("o", "order")),
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
l.AdditionalFullHelpKeys = l.AdditionalShortHelpKeys
@ -161,6 +162,11 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
sortFieldList.Title = modsTitle
sortFieldList.Styles = utils.ListStyles
sortFieldList.SetSize(l.Width(), l.Height())
sortFieldList.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
sortOrderList := list.New([]list.Item{
utils.SimpleItemExtra[modsList, ficsit.ModsModsGetModsModsMod]{
@ -192,6 +198,11 @@ func NewMods(root components.RootModel, parent tea.Model) tea.Model {
sortOrderList.Title = modsTitle
sortOrderList.Styles = utils.ListStyles
sortOrderList.SetSize(l.Width(), l.Height())
sortOrderList.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
m := &modsList{
root: root,
@ -272,6 +283,11 @@ func (m modsList) Init() tea.Cmd {
func (m modsList) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.list.KeyMap.Quit.SetHelp("q", "back")
m.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
switch msg := msg.(type) {
case tea.KeyMsg:

View file

@ -5,6 +5,7 @@ import (
"fmt"
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
"github.com/charmbracelet/bubbles/spinner"
tea "github.com/charmbracelet/bubbletea"
@ -36,6 +37,11 @@ func NewModVersionList(root components.RootModel, parent tea.Model, mod utils.Mo
l.Styles = utils.ListStyles
l.SetSize(l.Width(), l.Height())
l.KeyMap.Quit.SetHelp("q", "back")
l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
m := &selectModVersionList{
root: root,

View file

@ -4,6 +4,7 @@ import (
"fmt"
"time"
"github.com/charmbracelet/bubbles/key"
"github.com/charmbracelet/bubbles/list"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
@ -79,6 +80,11 @@ func NewProfile(root components.RootModel, parent tea.Model, profileData *cli.Pr
model.list.SetSize(model.list.Width(), model.list.Height())
model.list.StatusMessageLifetime = time.Second * 3
model.list.KeyMap.Quit.SetHelp("q", "back")
model.list.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}
return model
}

View file

@ -33,6 +33,7 @@ func NewProfiles(root components.RootModel, parent tea.Model) tea.Model {
l.AdditionalShortHelpKeys = func() []key.Binding {
return []key.Binding{
key.NewBinding(key.WithKeys("n"), key.WithHelp("n", "new profile")),
key.NewBinding(key.WithKeys("enter"), key.WithHelp("enter", "select")),
}
}