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

gum table: Add the ability to choose which row is highlighted by default when the script is run #844

Open
bpfoley opened this issue Feb 5, 2025 · 0 comments

Comments

@bpfoley
Copy link

bpfoley commented Feb 5, 2025

I find myself using gum table in a loop in a shell script where I want to process one item at a time from a large list of items. It gets very tedious to repeatedly scroll down through a large list to find the next item I want to process.

A simplified example of this script looks something like:

#!/bin/bash

echo "ID,Abbr,Food" > fruit.csv
echo "10,H,hazelnut" >> fruit.csv
echo "2,A,apple" >> fruit.csv
echo "3,N,nut" >> fruit.csv
echo "4,D,durian" >> fruit.csv
echo "0,E,exit" >> fruit.csv

ITEM=exit
while true; do
    ITEM=$(gum table -f fruit.csv -q $ITEM -i 3 -r 3)
    [ $ITEM == exit ] && break
    echo "Added $ITEM to basket"
done

I'd like to add the command line flags -i <column-number> -q <item-text> to search for the row to select when gum tabledisplays the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant