Repository navigation
Conversation
sqlmux <conn|file|url> --table <[schema.]table> starts a throwaway single-table view with --where/--cols/--hide/--order/--limit/--zoom/--readonly/--db/--transpose/--sidebar. It synthesizes a config.Layout and reuses Restore/Adopt (no core change); --cols (show only these columns) is a new LayoutTab.Show, applied once the first page's columns are in. Exit writes no last.toml.
|
Okay, I've taken a rough look, and I'll test this as soon as possible to see if it works! Thank you for your contribution. |
|
Thanks for the PR and the clear write-up! I built 1. The documented order doesn't parse. Go's The example in the description and in §14 ( 2. Saved layouts already cover the "I open this table a lot" case. Set the table up once: zoom, If saving a layout misses part of your use case, please open an issue describing it, for example a quick one-off view you don't want to save, or a column whitelist instead of a hide list. New features start in our design doc ( |
|
Thanks again for this, and sorry for the earlier "no". On a second look we agree the use case is real: a saved layout per table does not scale when you just want a quick look at one table. We built a narrowed version ourselves instead of merging this branch, because our design starts in
So Closing this one in favour of that. Thanks for the idea and the clear write-up. |
|
A follow-up for anyone who lands here: v0.10.0, out today, builds on the
The flags go before or after the connection. Neither kind of run overwrites the layout sqlmux prod --table orders --where "user_id = 42"
sqlmux prod --sql "select status, count(*) from orders group by 1"
sqlmux prod --schema sales --table orders# ~/.config/sqlmux/config.toml
default_connection = "prod" # then just: sqlmux --table ordersThe other flags from this PR ( To upgrade: |
1 ## What
2
3
sqlmux <conn|file|url> --table <[schema.]table>opens a throwaway single-table view directly — for the "I look at this table a lot" case, instead of opening the TUI, navigating to the table, zooming (Spc+z), picking columns (gc) and typing a filter (/) every time.4
5 Flags (each sets only the initial state; everything stays live in the TUI afterwards):
6
7 -
--where <cond>— apply a filter immediately8 -
--cols <a,b,c>— show only these columns, in this order9 -
--hide <a,b,c>— hide these columns10 -
--order "col desc, col2"— sort11 -
--limit <n>— rows per page12 -
--zoom— fullscreen the pane13 -
--readonly— force read-only14 -
--db <name>— PG / Redis / SQL Server database15 -
--transpose— transposed view16 -
--sidebar— show the connection tree (hidden by default)17
18 Example:
19
20
sh 21 sqlmux myconn --table users --cols id,name,amount --zoom --where "name = 'x'" 2223
24 ## How
25
26 Non-destructive by construction: it synthesizes an in-memory
config.Layoutand reuses the existingRestore/Adoptpath that--layoutalready takes — no changes to the Update / View / keymap state machine.--tableexits without writinglast.toml(a throwaway view).27
28
--cols(show only) is the one small addition to the core: aLayoutTab.Showfield, applied once the first page's columns arrive (ingotPage), after which column control is handed back to the user.29
30 ## Docs & tests
31
32 - Documented in
specs/design/14-config.md.33 - Unit tests for flag parsing / layout synthesis and for the
--colsapplication.34
35 ## Check status
36
37
go vet,go test ./...(all packages),gofmt, andgo mod tidy(no change) pass. I could not runjust test-integration(needs Docker) orjust lint(needs golangci-lint) in this environment.