csvtool/commands.go
exe.dev user ab2d281aad
Some checks failed
Build / build-linux (push) Failing after 14s
Build / build-linux-webkit2_41 (push) Failing after 14s
Build / build-macos (push) Successful in 3m21s
Add Sort Advanced command with multi-column sort
Opens a modal with a text field supporting autocomplete of column
names. Enter comma-separated column names in priority order;
rows are sorted ascending using locale-aware numeric comparison,
first by the first column, then by the second, and so on.

Autocomplete filters to matching headers, excludes already-chosen
columns, and supports keyboard navigation (arrows + enter).

Co-authored-by: Shelley <shelley@exe.dev>
2026-03-05 02:41:41 +00:00

38 lines
1.4 KiB
Go

package main
// Command represents a command that can be executed in the application.
type Command struct {
ID string `json:"ID"`
Name string `json:"Name"`
Shortcut string `json:"Shortcut"`
}
// CommandRegistry provides command metadata to the frontend.
type CommandRegistry struct{}
// NewCommandRegistry creates a new CommandRegistry.
func NewCommandRegistry() *CommandRegistry {
return &CommandRegistry{}
}
// GetCommands returns the list of all available commands.
func (c *CommandRegistry) GetCommands() []Command {
return []Command{
{ID: "copy", Name: "Copy", Shortcut: "Cmd+C"},
{ID: "cut", Name: "Cut", Shortcut: "Cmd+X"},
{ID: "copy-markdown", Name: "Copy as Markdown", Shortcut: ""},
{ID: "copy-jira", Name: "Copy as Jira", Shortcut: ""},
{ID: "paste", Name: "Paste", Shortcut: "Cmd+V"},
{ID: "resize-all", Name: "Resize All Columns", Shortcut: ""},
{ID: "open", Name: "Open File", Shortcut: "Cmd+O"},
{ID: "save", Name: "Save File", Shortcut: "Cmd+S"},
{ID: "open-up", Name: "Insert Row Above", Shortcut: ""},
{ID: "open-down", Name: "Insert Row Below", Shortcut: ""},
{ID: "open-left", Name: "Insert Column Left", Shortcut: ""},
{ID: "open-right", Name: "Insert Column Right", Shortcut: ""},
{ID: "sort-asc", Name: "Sort A-Z", Shortcut: ""},
{ID: "sort-desc", Name: "Sort Z-A", Shortcut: ""},
{ID: "sort-advanced", Name: "Sort Advanced", Shortcut: ""},
}
}