Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ask, choose, confirm: implement #99, #213, #188 #229

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

balupton
Copy link
Member

@balupton balupton commented Jun 12, 2024

WIP — Work still ongoing for #188, and timeout tests need to be added for #99

/ref #99, #213, #188

balupton and others added 16 commits February 25, 2024 12:42
* ask: support editing the default value /ref 6357fac
* ask: as read now supports defaults, redo the confirm flow /ref ddff467
* ask: use cursor rather than alt tty, implement --linger /ref 4d3e6fb
- implement `--linger`, default to enabled
- fix readline defaults failing when programatic stdin
- fix tests
- fix `echo-clear-lines` not retaining inlines which caused incorrect lines to be cleared
- adapt callers for new defaults and expectations
Still need to imlpement:
- `--linger`
- `--confirm-default=no`
- `--confirm-input`

...and to make them consistent between ask, confirm, choose.

This removes `--filter` from choose, as it is better facilitated by the new `--default(s)-fuzzy=`

/close #188
changes:

- bash.bash:
    - native __ prefix on methods, b/c alias (rather than non-performant inverse)
    - removed unused __print_lines_no_trail
- ask, choose, confirm:
    - fix question title and body implementation, title is uniformly bold
    - linger answer will be dim
    - fix outdated linger option implementation
    - implement confirm on choose
    - implement linger on confirm
    - new options implemented in caller where appropriate
- dorothy: remove require_globstar as already provided by bash.bash
- get-flag-value:
    - remove unused complex --*-fallback options, fix inversions
    - update tests
- macos-settings: remove fodder usage, was unnecessary

todos:

- need to update tests for ask, confirm, choose
…ults, which unfortunately was left behind on my mac mini when I did the rebase on my macbook

# Conflicts:
#	commands/ask
#	commands/choose-menu
#	commands/confirm
#	commands/setup-git
#	commands/sparse-vault

Also:

- implement better timeout and error handling, no need for a delay anymore, and now commentary visible in linger
- update callers accordingly, also update `dorothy` to remove unnecessary indentation, update `echo-lines` to remove typo in comment
- add tests for the `echo-trim-colors` new handling of inline

Still need to:

- `choose`:
    - update tests for rewrite
    - fix duplicate `DEFAULTS` in choose (probably a long-standing regression)
    - support multiple default matches in `--no-multi` (as done by `echo-checksum`) by adding the concept of preferences
    - see details at #188 (comment)
- add linger and timeout tests to `ask`, `choose`, `confirm`
- ask/choose/confirm: remove delay on errors
- choose-path: fix help usage convention
- read-key: rewrote hotkey handling for documented cross-os support, with support for more hotkeys
- styles: documented terminal emulator support for all complex styles
- choose: rewrite for page-up, page-down, home, end support, and do infrastructure for new confirm menu and paging indicators
this adds the infrastructure for a possible "cancel" menu mode
changes:
- deprecated `echo-element` and `echo-segment`, as they are now supported by `echo-style`
- `echo-style` and `styles.bash` updated for begin/end and color/nocolor styles
- `echo-style` updated to do the minimal writes for performance and simplicity
- `styles.bash` now has the `choose` styles, so `choose` theme can be customised by the user
- `choose` fixed and styled no selection / no items

/close #232
/ref #231 #188
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants