Commit graph

29 commits

Author SHA1 Message Date
Maas Lalani 44906e23b9
Use Huh for Gum Choose (#521)
* feat: use huh for gum choose (select + multiselect)

Uses Select for gum choose and MultiSelect for gum choose --no-limit.

* chore: bump to 1.21
2024-03-28 14:22:03 -04: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
Maas Lalani a61f3bdc3f
fix(choose): --no-limit when 1 option available should still allow selection 2023-07-25 12:38:55 -04:00
Maas Lalani 6763de12e8
fix(choose): set initial page for selected 2023-07-25 12:34:00 -04:00
Dieter Eickstaedt d1ad453ce6
feat: Timeout for Choose Command (#384) 2023-06-30 09:28:46 -04:00
Maas Lalani 6dbadf30b4 fix: strip ansi when stdout is not a tty 2023-04-06 17:36:29 -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
Maas Lalani 99e6625a39
fix: don't use deprecated pager functions 2023-03-03 13:15:50 -05:00
Dhruv Manilawala 08ed3e2519
feat(choose): keep order of selected items (#182)
* feat(choose): keep order of selected items

* fix: KeepOrder -> Ordered

Co-authored-by: Maas Lalani <maas@lalani.dev>
2023-01-12 13:36:11 -05:00
Maas Lalani c8e6b4a9d5
fix: trim only trailing newline, space may be intentional 2022-12-13 15:41:01 -05:00
Maas Lalani 2e4ddce3f7
fix: use program.Start 2022-10-17 20:23:59 -04:00
Dhruv Manilawala 2c66222fd8 fix(choose): error if selected options > limit
Rationale: If the number of selected options in `--selected` flag is
greater than the limit, the last `n` options are selected where `n` is
the limit.
2022-10-13 11:01:21 -04:00
Maas Lalani db75c218de
fix(choose): selected bug when limit == 1 2022-10-07 18:57:26 -04:00
Matt Farstad fa533691c4
feat(choose): Preselect the Selected Option When Limit is One (#166)
* Add startingIndex variable to choose model

* refactor: simplify code branches

Co-authored-by: Matthew Farstad <matthewwilliamfarstad@gmail.com>
Co-authored-by: Maas Lalani <maas@lalani.dev>
2022-10-02 12:51:35 -04:00
Vaniel 76fc2f3d91 feat(choose): improving selected option parse 2022-09-06 16:13:53 -04:00
Vaniel 6abc94c87a feat(choose): add --selected option to choose command 2022-09-06 16:13:53 -04:00
Maas Lalani 81602545a6
refactor: don't trim newline if we are going to Println anyway
Just use `Print` with the newline
2022-09-02 14:37:26 -04:00
Maas Lalani 1479184f3f fix: satisfy all linters 2022-08-05 02:33:40 -04:00
Maas Lalani 5c6453b07c
fix(choose): ctrl+c aborts with exit 130 2022-07-30 22:12:59 -04:00
Ayman Bagabas eaef49cdbe
feat: autocompletion 2022-07-25 13:03:18 -04:00
Maas Lalani 4d98a8fa6f
feat(choose): Add paginator to chooser
Display paginator only if number of options > height specified
2022-07-13 15:49:15 -04:00
Maas Lalani 54f85439fa
feat(choose): --no-limit flag alias
Adds a --no-limit flag as an alias to set the limit to the number of options available.
2022-07-13 12:10:38 -04:00
Maas Lalani 01404ef586
feat(choose): Ability to choose multiple choices --limit
This commit introduces the ability to choose multiple options from the list of choices in `gum choose` by adding a `--limit` flag.
2022-07-13 11:45:52 -04:00
Maas Lalani 7190822247
refactor(kong): Implement Run(...) error interface
Instead of needing to run the commands manually in main.go, we can implement the `Run(...) error` method to satisfy the command interface so that `kong` can Run our commands for us.
2022-07-12 22:33:52 -04:00
Maas Lalani 02e925ea57
refactor: use embedded style struct for all lipgloss styling
This commit uses the embedded style struct for styling in all components. The most notable example is `gum write` where there are many styles that are used and composed for each component of the command.
2022-07-12 16:08:33 -04:00
Maas Lalani 46ddc28ae5
feat: gum choose, pick from a list of choices
gum choose allows the user to be prompted for a choice from a list of choices.

For example, let's ask the user to pick a card from a deck.
gum choose --height 15 {Ace,King,Queen,Jack,Ten,Nine,Eight,Seven,Six,Five,Four,Three,Two}" of "{Spades,Hearts,Clubs,Diamonds}
2022-07-11 16:26:23 -04:00