Commit graph

80 commits

Author SHA1 Message Date
Carlos Alexandro Becker
6045525ab9
feat: adding --padding to most commands (#960)
* feat(filter,choose): allow UI to be padded

* feat: --padding everywhere

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: unrelated lint issue

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: filter

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: use ordered.Clamp

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2025-09-05 13:55:10 -03:00
Carlos Alexandro Becker
0107dffd27
fix(filter): text input width is too small (#919)
close #913
2025-06-10 15:42:57 -03:00
Carlos Alexandro Becker
817c4bd446
fix: lint issues (#909)
* fix: some of the lint issues

* fix: staticcheck
2025-05-30 10:34:31 -03:00
Raphael Amorim
9705aa3384
fix: generated completion invalid for fish shell (#837) 2025-02-03 14:43:46 -03:00
Carlos Alexandro Becker
37456557c4
fix(filter): wrong highlight when option has grapheme clusters (#799) 2025-01-22 12:51:18 -03:00
Carlos Alexandro Becker
bb34c45fe1
fix(filter): take pre-filtering into account 2025-01-12 17:42:52 -03:00
Carlos Alexandro Becker
b0ec3a7915
fix(filter): select all
refs https://github.com/charmbracelet/gum/pull/777#issuecomment-2585836624

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2025-01-12 17:40:44 -03:00
Carlos Alexandro Becker
da325ae345
fix(filter): wide chars
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2025-01-07 11:28:20 -03:00
Carlos Alexandro Becker
d3d20efc70
fix(filter): properly handle options with ansi styles (#789)
* fix(filter): handle styles option matches

* perf: use ranges

* fix: cut

* fix: ansi update
2025-01-07 11:08:24 -03:00
Carlos Alexandro Becker
4cedf9fca0
feat: --no-strip-ansi (#784)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Sridaran Thoniyil <sri7thon@gmail.com>
2024-12-17 13:56:19 -03:00
Carlos Alexandro Becker
6d405c49b1
feat(choose,filter): --input-delimiter --output-delimiter (#779)
* feat(choose,filter): --input-delimiter --output-delimiter

allows to change how content from stdin is used, and how results are
printed.

one could get around it piping into and from `tr`, but results aren't
quite right, especially when `tr '\n' ','` for example, as it'll add an
extra `,` in the end of the string.

This makes things a bit cleaner, hopefully.

closes #274

* fix: use new tty pkg
2024-12-13 17:03:42 -03:00
Carlos Alexandro Becker
0e501ea47f
feat(filter): --select-if-one returns if single match (#778)
closes #311

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-13 16:59:59 -03:00
Carlos Alexandro Becker
966237b378
feat(filter): allow to pre-select items with --selected (#777)
closes #593
2024-12-13 16:59:44 -03:00
Carlos Alexandro Becker
f230a3d5fc
feat(filter): allow to focus out of filter (#776)
- esc focus out of the filter
- esc with filter blurred quits
- g/G/j/k navigation when filter is blurred

closes #201
2024-12-13 16:59:32 -03:00
Carlos Alexandro Becker
74c1079c9d
feat(filter): ctrl+a to toggle select all (#770)
closes #388
2024-12-12 10:12:28 -03:00
Carlos Alexandro Becker
774667a943
feat(choose,confirm,file,filter,input,table,write): esc exit 1, ctrl+c exit 130, help arrow order (#771)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-11 23:23:33 -03:00
Carlos Alexandro Becker
2939e516cc
fix(pager): do not strip ansi sequences (#754) 2024-12-09 17:54:17 -03:00
Carlos Alexandro Becker
71d7e6539c
feat: handle focus/blur events (#749)
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-09 14:41:29 -03:00
Carlos Alexandro Becker
4f469522d5
feat: handle interrupts and timeouts (#747) 2024-12-09 14:30:35 -03:00
Carlos Alexandro Becker
e30fc5ecdf
refactor: removing huh as a dep (#742)
* Revert "feat: huh gum write (#525)"

This reverts commit 4d5d53169e.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* Revert "Use Huh for Gum Confirm (#522)"

This reverts commit f7572e387e.

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* revert: Use Huh for Gum Choose (#521)

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* revert: feat: huh for gum input (#524)

* revert: feat: huh file picker (#523)

* feat: remove huh

* fix: timeouts

* fix: lint issues

* fix(choose): quit on ctrl+q

ported over 63a3e8c8ce

* fix: ctrl+a to reverse selection

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: better handle spin exit codes

* fix(file): bind --[no-]permissions and --[no-]size

* feat(confirm): show help

* fix(confirm): fix help style

* fix(file): help

* fix(input): --no-show-help doesn't work

* fix(input): help

* fix(file): keymap improvement

* fix(write): focus

* feat(write): ctrl+e, keymaps, help

* feat(choose): help

* feat(filter): help

* refactor: keymaps

* fix(choose): only show 'toggle all' if there's no limit

* fix(choose): don't show toggle if the choices are limited to 1

* fix(filter): match choose header color

* fix(filter): add space above help

* fix(filter): factor help into the height setting

* chore(choose,filter): use verb for navigation label in help

* fix(filter): hide toggle help if limit is 1

* fix(file): factor help into height setting (#746)

* fix: lint issues

* fix(file): handle ctrl+c

* fix: remove full help

* fix: lint

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2024-12-09 13:18:35 -03:00
Carlos Alexandro Becker
29250f8feb
fix(filter): --no-strict not working, also weird behavior (#737)
- `--no-strict` was erroring as non-existent option
- when `--no-strict`, we should actually create a "fake" option with
  whatever the user is typing

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-04 10:34:22 -03:00
Carlos Alexandro Becker
c422e76fe3
fix: clarify filter --sort flag (#738)
* fix: clarify filter --sort flag

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: if sort, sort options alphabetically first

* Revert "fix: if sort, sort options alphabetically first"

This reverts commit 86e8fc0a5b.

* fix: filter

* Update filter/options.go

Co-authored-by: Christian Rocha <christian@rocha.is>

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Christian Rocha <christian@rocha.is>
2024-12-04 09:02:06 -03:00
Carlos Alexandro Becker
098d09a270
fix(choose,confirm,file,filter,input,pager,spin): timeout default unit (#724)
Change it `0s` instead of `0`.

closes #402
2024-11-18 17:10:06 -03:00
Carlos Alexandro Becker
3cec9b7b9a
fix(filter): panic if no matches
closes #715

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-11-18 10:00:10 -03:00
Carlos Alexandro Becker
b9611e1d83
fix: lint issues (#663) 2024-09-06 12:06:27 -03:00
Carlos Alexandro Becker
046a4d361e
fix: use 0 as default width (#634)
* fix: use 0 as default width

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>

* fix: filter width

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-07-25 13:12:30 -04:00
Piero Lescano
8422c49018
feat(filter): Add cyclic navigation (#483) 2024-07-25 10:02:56 -04:00
Mikael Fangel
b0f4413188
chore: remove explicitly defined max functions (#613)
* filter: remove max function

* timeout: remove max function
2024-07-25 09:57:35 -04:00
Ayman Bagabas
c5aa209eed refactor(ansi): drop ansi in favor for x/ansi 2024-07-16 15:17:46 -04:00
Ayman Bagabas
405f246635 refactor: use x/term instead of go-isatty 2024-07-16 15:17:46 -04:00
Mikael Fangel
2fe0291e02
fix(stdin): add trim of trailing newline (#577)
* stdin: add trim of trailing newline

* choose: remove trimsuffix

* filter: remove trimsuffix

* style: remove trimsuffix
2024-05-25 14:44:01 -04:00
Maas Lalani
2d896f777e feat(filter): allow customizing placeholder 2024-01-13 15:33:58 -05:00
snan
a11d1ff648
fix: Make --select-if-one print to stdout (#463)
For some reason it wasn't printing to stdout (and I could repro that
bug even on versions before I added the newline). It was only showing
up on other streams in the shell (error stream probably), not getting
sent into pipes.

I changed it to fmt.Println.

As for the ansi-stripping that was in `filter`, LMK if that's what you
prefer and I'll add it to `choose` too. I just wanted them to match.
2023-12-10 13:52:11 -05:00
snan
d1145b4163
Add newline printing to --select-if-one (#459)
* Add newline printing to --select-if-one

This matches how choose works normally when there are more than
one option.

* Add newline printing to filter --select-if-one

To match how it works without --select-if-one.
2023-12-07 10:29:40 -05:00
Maas Lalani
01a66511a1
Hide Style Flags consistently (#457)
* refactor: hide style flags on error to not clutter usage

* docs(style): add comment regarding dynamically hiding flags
2023-11-28 14:17:57 -05:00
Kenny Parnell
fb6849ca16
Add --select-if-one flag to choose/filter. (#398)
* Add `--select-if-one` flag to `choose`/`filter`.

* Remove accidental commit of other changes.

* fix: use o.Options

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-11-28 12:34:50 -05:00
Mikael Fangel
971b6cf16f
fix(filter): made filter work with lists as choose (#424)
* made filter work with lists as choose

* lint fix

* response to code review
2023-10-03 16:33:57 -04:00
Dieter Eickstaedt
7e71c4d664
feat: Adding timeout option to Filter command (#380) 2023-06-29 17:29:46 -04:00
ROMAIN GUISSET
99f1348a45 feat(filter): add cursor text line styling 2023-06-27 10:37:13 -04:00
Carlos Alexandro Becker
5a4b12c8ca feat: gum filter --no-sort
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2023-05-30 09:42:41 -05:00
Maas Lalani
92c890e717
fix: use lipgloss.Width instead of runewidth.StringWidth 2023-05-11 22:21:09 -04:00
Maas Lalani
5887a10fa0 fix: strip ansi from gum filter when output is not a tty 2023-04-06 17:36:29 -04:00
Maas Lalani
bb103c0a03
fix: show header only if not empty 2023-03-22 11:17:06 -04:00
Mikael Fangel
97feb1b4d0
feat: adds headers for choose and filter (#307)
* added header to choose

* corrected mistake in envvar

* added header for filter

* simplified return logic for filter

* Update choose/options.go

* render the header before calculating the height

---------

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-03-14 15:58:48 -04:00
mikael
708a653eae Fix for using --value in combination w/ --no-fuzzy
This add a check if the no fuzzy flag is set together with the
--no-fuzzy flag.
2023-03-09 12:42:55 -05:00
MuXiu1997
877c475aa6
feat: add ctrl+@(ctrl+space) keybinding for choose and filter (#276)
* feat(filter): add ctrl+@ keybinding

* feat(choose): add ctrl+@ keybinding
2023-02-27 18:59:40 -05:00
Maas Lalani
c8e6b4a9d5
fix: trim only trailing newline, space may be intentional 2022-12-13 15:41:01 -05:00
Dieter Eickstaedt
b0aba2261d
feature(choose): Adding option to use non-matching filter as result (#233) 2022-11-09 13:54:47 -05:00
Maas Lalani
2e4ddce3f7
fix: use program.Start 2022-10-17 20:23:59 -04:00
Maas Lalani
08c34cfa2f chore: use --[no-]fuzzy as flag 2022-10-13 10:58:57 -04:00