csvtool/commands.go
exe.dev user ae1d428e75
Some checks failed
Build / build-linux (push) Failing after 13s
Build / build-linux-webkit2_41 (push) Failing after 14s
Build / build-macos (push) Successful in 3m44s
Add Sort A-Z and Sort Z-A commands
Sorts all rows by the currently selected column using
locale-aware alphanumeric comparison (numeric: true).

Co-authored-by: Shelley <shelley@exe.dev>
2026-03-04 22:21:49 +00:00

37 lines
1.3 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: ""},
}
}