diff --git a/README.md b/README.md index 2426c58..0a61d88 100644 --- a/README.md +++ b/README.md @@ -119,8 +119,8 @@ The mouse works too: click to select, click `▸` to toggle, wheel to move. ## Status -A prototype. Browsing is complete; the actions `u` (check out the pin) and `b` (bump the pin to the tip) are -planned. +A prototype. Browsing is complete and read-only; write actions (restore, +stage pin) are being specified in [docs/actions.md](docs/actions.md). ## Documentation diff --git a/docs/README.md b/docs/README.md index ae4e1d3..5db1b93 100644 --- a/docs/README.md +++ b/docs/README.md @@ -33,10 +33,10 @@ Installs `submarine` and the alias `sub` (linux/macOS, amd64/arm64) to through a git provider (`internal/submodule/git`): `submarine [dir]`. It fetches only when asked (`f`) and follows changes made in other shells. `submarine --mock` shows the built-in mock data (`internal/submodule/mock`). `!` shows only -submodules with problems. The actions `u` and `b` only show a "not -implemented" message ([drafts of the write actions](actions.md)). +submodules with problems. It is read-only so far; the first write actions +are [drafted](actions.md). Next steps, roughly in order: -1. Actions: checkout pin (`submodule update`), bump pin to tip, init. +1. Write actions: restore and stage pin, see [actions.md](actions.md). 2. (done) "Problems only" (`!`) view, reusing the tree's filter. diff --git a/docs/requirements.md b/docs/requirements.md index 7742365..284ebb2 100644 --- a/docs/requirements.md +++ b/docs/requirements.md @@ -89,7 +89,7 @@ commit hashes. It doesn't answer the questions users actually have: severe first), staged pins, how many are still loading, and the time since the last fetch. - **F31** The footer shows key hints; `?` toggles the full help. It - temporarily shows short messages (e.g. "not implemented"). + temporarily shows short messages (e.g. "copied "). ### Navigation @@ -128,14 +128,10 @@ commit hashes. It doesn't answer the questions users actually have: list is not mistaken for a healthy repository. See [Problems only](ux-guide.md#problems-only). -### Actions (planned, not implemented) +### Actions (planned) -| Key | Action | -|---|---| -| `u` | Check out the pinned commit (`git submodule update`) | -| `b` | Bump the pin to the tip of its ref | - -See [actions.md](actions.md) for the draft of the write actions. +The tool is read-only so far. The first write actions, restore and stage +pin, are drafted in [actions.md](actions.md). ## Usage diff --git a/docs/ux-guide.md b/docs/ux-guide.md index 576d48b..a9a232c 100644 --- a/docs/ux-guide.md +++ b/docs/ux-guide.md @@ -221,7 +221,6 @@ colors in components. | `c` | Copy the absolute directory of the selected submodule to the clipboard (OSC 52, so it also works over SSH; needs terminal support, in tmux `set -g set-clipboard on`). The footer confirms with `copied `. Without a local provider (mock) the path relative to the superproject is copied | | `/` | Open the filter, see [Filter](#filter) | | `!` | Toggle problems only, see [Problems only](#problems-only) | -| `u`, `b` | Planned actions (see requirements) | "First child" always means the first child **as displayed** (children are grouped by directory). @@ -276,29 +275,27 @@ the term*. ### Key reference -Every key in the UI, where it is shown, and whether it works. Update this -table when a key is added, moved or implemented. "Bar" is the short footer +Every key in the UI, where it is shown. Update this +table when a key is added or moved. "Bar" is the short footer bar, "Palette" the detail pane's palette (the footer takes its keys over where the palette can't be shown, see [Key bar and palette](#key-bar-and-palette)), "Help" the full help (`?`). -| Key | Action | Group | Shown in | Implemented | -|---|---|---|---|---| -| `↑` / `k`, `↓` / `j` | Move selection | Navigation | Bar, Help | yes | -| `←` / `h`, `→` / `l` | Fold / unfold, parent / first child | Navigation | Bar, Help | yes | -| `H` / `⇧←`, `L` / `⇧→` | Collapse / expand all | Navigation | Bar, Help | yes | -| `space` | Toggle expand/collapse | Navigation | Bar, Help | yes | -| `home` / `g`, `end` / `G` | Header / last submodule | Navigation | Help | yes | -| `pgup`, `pgdn` | Move by one screen | Navigation | Help | yes | -| `c` | Copy path | Submodule | Palette, Help | yes | -| `u` | Checkout pin | Submodule | Help | no (flashes "not implemented") | -| `b` | Bump pin to tip | Submodule | Help | no (flashes "not implemented") | -| `f` | Fetch all repositories | Global | Help | yes | -| `r` | Reload everything | Global | Help | yes | -| `/` | Filter | Global | Help | yes | -| `!` | Problems only (toggle) | Global | Help | yes | -| `?` | Toggle full help | Global | Bar, Help | yes | -| `q`, `ctrl+c` | Quit | Global | Bar, Help | yes | +| Key | Action | Group | Shown in | +|---|---|---|---| +| `↑` / `k`, `↓` / `j` | Move selection | Navigation | Bar, Help | +| `←` / `h`, `→` / `l` | Fold / unfold, parent / first child | Navigation | Bar, Help | +| `H` / `⇧←`, `L` / `⇧→` | Collapse / expand all | Navigation | Bar, Help | +| `space` | Toggle expand/collapse | Navigation | Bar, Help | +| `home` / `g`, `end` / `G` | Header / last submodule | Navigation | Help | +| `pgup`, `pgdn` | Move by one screen | Navigation | Help | +| `c` | Copy path | Submodule | Palette, Help | +| `f` | Fetch all repositories | Global | Help | +| `r` | Reload everything | Global | Help | +| `/` | Filter | Global | Help | +| `!` | Problems only (toggle) | Global | Help | +| `?` | Toggle full help | Global | Bar, Help | +| `q`, `ctrl+c` | Quit | Global | Bar, Help | ### Mouse diff --git a/internal/tui/app.go b/internal/tui/app.go index 22d5339..d5e1d7a 100644 --- a/internal/tui/app.go +++ b/internal/tui/app.go @@ -380,10 +380,6 @@ func (m Model) handleKey(msg tea.KeyMsg) (tea.Model, tea.Cmd) { case key.Matches(msg, k.Issues): m.tree.SetProblemsOnly(!m.tree.ProblemsOnly()) m.layout() - case key.Matches(msg, k.Update, k.Bump): - cmd := m.footer.Flash("“" + msg.String() + "” is not implemented in the prototype") - m.layout() - return m, cmd } return m, nil } diff --git a/internal/tui/keys.go b/internal/tui/keys.go index 615e696..dc7e104 100644 --- a/internal/tui/keys.go +++ b/internal/tui/keys.go @@ -3,11 +3,11 @@ package tui import "github.com/charmbracelet/bubbles/key" type keyMap struct { - Up, Down, Left, Right, Toggle key.Binding - CollapseAll, ExpandAll key.Binding - Home, End, PageUp, PageDown key.Binding - Update, Bump, Fetch, Reload, Filter, Issues key.Binding - Copy, Help, Quit key.Binding + Up, Down, Left, Right, Toggle key.Binding + CollapseAll, ExpandAll key.Binding + Home, End, PageUp, PageDown key.Binding + Fetch, Reload, Filter, Issues key.Binding + Copy, Help, Quit key.Binding } func defaultKeys() keyMap { @@ -23,8 +23,6 @@ func defaultKeys() keyMap { End: key.NewBinding(key.WithKeys("end", "G"), key.WithHelp("end/G", "last")), PageUp: key.NewBinding(key.WithKeys("pgup"), key.WithHelp("pgup", "page up")), PageDown: key.NewBinding(key.WithKeys("pgdown"), key.WithHelp("pgdn", "page down")), - Update: key.NewBinding(key.WithKeys("u"), key.WithHelp("u", "checkout pin")), - Bump: key.NewBinding(key.WithKeys("b"), key.WithHelp("b", "bump pin to tip")), Fetch: key.NewBinding(key.WithKeys("f"), key.WithHelp("f", "fetch")), Reload: key.NewBinding(key.WithKeys("r"), key.WithHelp("r", "reload")), Filter: key.NewBinding(key.WithKeys("/"), key.WithHelp("/", "filter")), @@ -59,7 +57,7 @@ func (k keyMap) FullHelp() [][]key.Binding { {k.Up, k.Down, k.Left, k.Right, k.Toggle}, {k.CollapseAll, k.ExpandAll}, {k.Home, k.End, k.PageUp, k.PageDown}, - {k.Copy, k.Update, k.Bump}, + {k.Copy}, {k.Fetch, k.Reload, k.Filter, k.Issues}, {k.Help, k.Quit}, }