Add Tool:pick - interactive pick-from-list helper - #24
Merged
Merged
Conversation
Options are read as lines from stdin, the chosen one is written to stdout. Uses fzf if available, otherwise gum, otherwise bash's builtin 'select' (reading from /dev/tty since stdin holds the options). Returns 1 with empty output when there are no options or the user cancels. Includes docs and bash_unit tests (fzf and gum branches are faked). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMDQ5o753Kzsa7NHRy8mxN
With a non-empty 2nd parameter, an extra "other: ..." option is appended to the list. Choosing it prompts the user (on the terminal) to type their own answer, which is trimmed and returned instead of a list entry. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VMDQ5o753Kzsa7NHRy8mxN
- 2nd parameter is now the label of the free-text option ("1" keeps "other: ...")
- 3rd parameter: default, returned when no choice can be made: with -f/--FORCE,
without a terminal (cron, CI) or on timeout; defaults to the first option
- 4th parameter: timeout in seconds (0 = wait forever); fzf/gum are stopped by
a watchdog (Tool:_pick_timeout), the bash menu uses read -t
- the 'select' fallback is replaced by a bash-only numbered menu with timeout support
- new Os:has_tty helper: true when there is a terminal to interact with
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VMDQ5o753Kzsa7NHRy8mxN
PR Summary
|
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.
Options are read as lines from stdin, the chosen one is written to
stdout. Uses fzf if available, otherwise gum, otherwise bash's builtin
'select' (reading from /dev/tty since stdin holds the options).
Returns 1 with empty output when there are no options or the user cancels.
Includes docs and bash_unit tests (fzf and gum branches are faked).
Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01VMDQ5o753Kzsa7NHRy8mxN