charmbracelet / gum

A tool for glamorous shell scripts 🎀
MIT License
17.94k stars 339 forks source link

Custom file details / preview #197

Open BlueFalconHD opened 1 year ago

BlueFalconHD commented 1 year ago

This is probably a simple feature, but being able to use the newly implemented file tool to pick multiple files would be nice. Maybe a feature to filter out certain files or change how results are separated. Also, being able to add a custom row of details, such as the status of that file via git.

Full example:


function isUntracked()
    set UNTRACKED "$(git ls-files --other --directory --exclude-standard)"

    if grep -q "$argv[1]" <<< "$UNTRACKED"
        echo "untracked"
    else
        echo ""
    end
end 

set FILE "$(gum file --multiselect --details "isUntracked {filename}" --multisep "\n" --filter "*.js"

echo "$FILE"
# returns:
# test.js
# test2.js
muesli commented 1 year ago

Let's focus on one request per ticket. We'll keep #199 open for multiple selections and track custom details/previews in this one here.

indigoviolet commented 6 months ago

@muesli there's an endless loop between #199 and #197 if you're interested in multiple selections :)

AndydeCleyre commented 5 months ago

Does this issue cover an option for gum filter like fzf's --preview?

Or does that fall under #502, or does it instead merit a new dedicated issue?