Skip to content

Feature request: non-interactive when 1 search matches #38

@focusaurus

Description

@focusaurus

I'd like a way to express "Given this stdin and this --search argument, if after filtering there's only 1 remaining candidate, select it and write to stdout non-interactively, but if there's >1, go into interactive mode".

fzf has an argument -f, --filter=STR Filter mode. Do not start interactive finder., which I use to simulate this by filtering the input then checking the number of matches with wc and if there's 1 just proceeding to use the result, but piping to fzf if necessary to filter further. It's close, but what I really want is as described above.

For example, given this use case, I'd rather just get cat on stdout immediately and have hs exit 0.

printf 'cat\nrat\nbat' | hs -s cat
> cat (1/3 choices)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions