Documentation
¶
Overview ¶
Package actions defines the action registry for configurable double-click actions. Each item type in the UI maps to a default action and a set of alternatives that the user may choose via first-use prompts or settings.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry = map[ItemType]ItemActions{ ItemLocalBranch: {Default: ActionCheckout, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyName, ActionOpenInBrowser}, Description: "switch to this branch"}, ItemRemoteBranch: {Default: ActionCheckout, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyName}, Description: "check out this remote branch locally"}, ItemWorktree: {Default: ActionSwitch, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionOpenTerminal, ActionCopyPath}, Description: "switch to this worktree"}, ItemRemote: {Default: ActionOpenInBrowser, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyURL}, Description: "open this remote in your browser"}, ItemStashEntry: {Default: ActionPromptAction, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionApply, ActionPop, ActionDrop}, Description: "choose a stash action (apply/pop/drop)"}, ItemIssue: {Default: ActionOpenInBrowser, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyURL, ActionCopyNumber}, Description: "open this issue in your browser"}, ItemPR: {Default: ActionOpenInBrowser, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionMergePR, ActionCopyURL, ActionCopyNumber, ActionCheckoutBranch}, Description: "open this pull request in your browser"}, ItemActionRun: {Default: ActionOpenInBrowser, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionRerun, ActionCopyURL}, Description: "open this workflow run in your browser"}, ItemWorkflow: {Default: ActionDispatch, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionOpenInBrowser, ActionCopyURL}, Description: "dispatch this workflow"}, ItemRelease: {Default: ActionOpenInBrowser, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionDownloadAssets, ActionCopyURL, ActionCopyName}, Description: "open this release in your browser"}, ItemFile: {Default: ActionOpenInEditor, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyPath, ActionStage, ActionPreview}, Description: "open this file in your editor"}, ItemDirectory: {Default: ActionExpandCollapse, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyPath}, Description: "expand or collapse this directory"}, ItemCommit: {Default: ActionShowDetail, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyHash, ActionOpenInBrowser}, Description: "show details for this commit"}, ItemStatusFile: {Default: ActionExpandDiff, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionStageUnstage, ActionCopyPath}, Description: "expand the inline diff for this file"}, ItemLogCommit: {Default: ActionShowDetail, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionCopyHash}, Description: "show details for this commit"}, ItemStash: {Default: ActionApply, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionPop, ActionDrop, ActionShowDetail}, Description: "apply this stash entry"}, ItemConflictFile: {Default: ActionOpenDiff, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionResolveOurs, ActionResolveTheirs}, Description: "open the diff for this conflicted file"}, ItemReviewFile: {Default: ActionExpandDiff, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionApprove, ActionCopyPath}, Description: "expand the diff for this file"}, ItemContextFile: {Default: ActionPreview, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionRemove, ActionCopyPath}, Description: "preview this file"}, ItemBookmark: {Default: ActionJump, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionDelete, ActionCopyPath}, Description: "jump to this bookmark"}, ItemExtension: {Default: ActionToggleDetails, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionEnableDisable}, Description: "show details for this extension"}, ItemAgent: {Default: ActionToggleOutput, RightClick: ActionShowContextMenu, Alternatives: nil, Description: "expand output for this agent"}, ItemSetting: {Default: ActionCycleValue, RightClick: ActionShowContextMenu, Alternatives: nil, Description: "cycle this setting value"}, ItemTag: {Default: ActionCheckout, RightClick: ActionShowContextMenu, Alternatives: []ActionID{ActionPush, ActionDelete, ActionCopyName, ActionCopyHash}, Description: "checkout this tag (detached HEAD)"}, }
Registry maps each item type to its available actions.
Functions ¶
func ActionLabel ¶
ActionLabel returns a human-readable label for an action ID. Falls back to the raw action ID string for unknown actions.
func Description ¶
Description returns the human-readable prompt description for an item type's default action. Returns an empty string for unknown item types.
func IsValidAction ¶
IsValidAction checks if the given action is valid for the item type.
Types ¶
type ActionID ¶
type ActionID string
ActionID identifies a specific action that can be performed on an item.
const ( ActionCheckout ActionID = "checkout" ActionSwitch ActionID = "switch" ActionOpenTerminal ActionID = "open_terminal" ActionOpenInBrowser ActionID = "open_in_browser" ActionOpenInEditor ActionID = "open_in_editor" ActionPromptAction ActionID = "prompt_action" ActionApply ActionID = "apply" ActionPop ActionID = "pop" ActionDrop ActionID = "drop" ActionExpandCollapse ActionID = "expand_collapse" ActionShowDetail ActionID = "show_detail" ActionExpandDiff ActionID = "expand_diff" ActionStageUnstage ActionID = "stage_unstage" ActionOpenDiff ActionID = "open_diff" ActionResolveOurs ActionID = "resolve_ours" ActionResolveTheirs ActionID = "resolve_theirs" ActionPreview ActionID = "preview" ActionJump ActionID = "jump" ActionToggleDetails ActionID = "toggle_details" ActionEnableDisable ActionID = "enable_disable" ActionToggleOutput ActionID = "toggle_output" ActionCycleValue ActionID = "cycle_value" ActionCopyName ActionID = "copy_name" ActionCopyURL ActionID = "copy_url" ActionCopyNumber ActionID = "copy_number" ActionCopyHash ActionID = "copy_hash" ActionCopyPath ActionID = "copy_path" ActionStage ActionID = "stage" ActionApprove ActionID = "approve" ActionRemove ActionID = "remove" ActionDelete ActionID = "delete" ActionRerun ActionID = "rerun" ActionDispatch ActionID = "dispatch" ActionDownloadAssets ActionID = "download_assets" ActionCheckoutBranch ActionID = "checkout_branch" ActionMergePR ActionID = "merge_pr" ActionShowContextMenu ActionID = "context_menu" ActionPush ActionID = "push" )
func AllActions ¶
AllActions returns the default action followed by all alternatives for an item type. Returns nil if the item type is not registered.
func AllRightClickActions ¶
AllRightClickActions returns the context menu action followed by all available actions for an item type (default + alternatives).
func DefaultAction ¶
DefaultAction returns the default double-click action for an item type. Returns an empty ActionID if the item type is not registered.
func RightClickAction ¶
RightClickAction returns the default right-click action for an item type. Returns an empty ActionID if the item type is not registered.
type ItemActions ¶
type ItemActions struct {
Default ActionID
RightClick ActionID // default right-click action (usually ActionShowContextMenu)
Description string // human-readable prompt text for the default action
Alternatives []ActionID
}
ItemActions defines the default action and alternatives for an item type.
type ItemType ¶
type ItemType string
ItemType identifies a clickable item category in the UI.
const ( ItemLocalBranch ItemType = "local_branch" ItemRemoteBranch ItemType = "remote_branch" ItemWorktree ItemType = "worktree" ItemRemote ItemType = "remote" ItemStashEntry ItemType = "stash_entry" ItemIssue ItemType = "issue" ItemPR ItemType = "pr" ItemActionRun ItemType = "action_run" ItemWorkflow ItemType = "workflow" ItemRelease ItemType = "release" ItemFile ItemType = "file" ItemDirectory ItemType = "directory" ItemCommit ItemType = "commit" ItemStatusFile ItemType = "status_file" ItemLogCommit ItemType = "log_commit" ItemStash ItemType = "stash" ItemConflictFile ItemType = "conflict_file" ItemReviewFile ItemType = "review_file" ItemContextFile ItemType = "context_file" ItemBookmark ItemType = "bookmark" ItemExtension ItemType = "extension" ItemAgent ItemType = "agent" ItemSetting ItemType = "setting" ItemTag ItemType = "tag" )
func AllItemTypes ¶
func AllItemTypes() []ItemType
AllItemTypes returns all registered item types in display order.
func ConfigurableItems ¶
func ConfigurableItems() []ItemType
ConfigurableItems returns all item types that have at least one alternative action, in a stable display order.