feat: Actions, named commands bound to keys in the Picker (#62) - #76
Merged
Merged
Conversation
… its exit status (#62)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
internal/actionpackage: theActiontype, the built-in registry (builtins, empty for now),Merge(user[actions.<name>]tables override a built-in field by field), key validation and theRunnerinterface withExecRunner.[actions.*]and validates at load. Errors name the line: unknown key,escandctrl+c, a plain printable key withoutkeys.vim, two Actions on one key, and a missingrun.Runnerand the Picker stays open; a failure to start shows on the footer's key line until the next key press. Any other Action quits the Picker with the Action in the newpicker.Choice.jump.Resolveruns a non-detached Action after the Picker quits, on/dev/ttyfor all three streams, records a Visit, prints the path only forjump = truewith a zero exit, and passes a non-zero status on viajump.ExitError(the CLI exits with it, silently). Detached Actions record their Visit through a recordingRunnerwrapper.CONTEXT.mddefines Action; the README documents Actions.Enteris unchanged (feat(picker): Enter is the remappable jump Action #63 moves it onto the Action map).Verification
gofmt -l .empty,go vet ./...clean,go test ./...passes except the known fish cases ofTestScriptExecution.internal/action), config line numbers (internal/config), key dispatch with a fake runner including the footer message (internal/picker), the Resolve flows with a fake runner (internal/jump), andExecRunneragainst a fake tty file (path with a space and a quote,CDD_PATH, cwd, exit status, detached start and start failure).XDG_CONFIG_HOME: a config bindingctrl+cfails withline 8: actions.bad: key: "ctrl+c" can never be bound; a valid one loads.Closes #62