reversed(top()) code tags rss about

New tool: pipedial (terminal element picker)

January 24, 2019
[bash] [c++] [c++11] [curses] [programming] [shell] [terminal] [tools]

pipedial is one more tool for selecting something in console. Existence of many such tools might be a valid criticism against creating more, but not for those who think in terms of h/j/k/l.

pipedial was written out of despair because of absence of selectors like sentaku that implements Vim-like modes (it has Emacs mode too). The problem with sentaku is that it’s horribly slow (you can see elements being drawn top to bottom). It comes out of it being written in bash, which makes it easy to use at the expense of performance.

A lot of existing pickers have not much going on in favour of their existence being rewrites of other tools for no good reason. Yet nobody seemed to care about writing something like sentaku, but without its horrible lags. It’s worth noting that a number of pickers out there are actually quite original, but unfortunately they lack modes and adding them doesn’t look like an easy task (pipedial just reuses code from vifm, which didn’t take much effort).

Features

Nothing impressive here. It’s very simple and currently (v0.1) provides only basic Vim-like mappings and substring filtering. It’s also just black and white, mostly because I haven’t yet decided on how colorization should be implemented in the code.

Why use it

It might be of interest to people who like the simplicity and modes of sentaku, but are annoyed by its performance issues and occasional bugs (resizing/drawing issues). Additional difference is that prompt is implemented using readline so all of its text editing goodness is available (sentaku probably can’t do it because read -e won’t allow for interactive filtering).

Usage example

Example bash function:

# interactive version of switching to a git branch
function igo()
{
    local branches
    branches=$(git branch 2> /dev/null | sed -e '/^\* /d' -e 's/^..//')
    if [ $? -ne 0 ]; then
        echo Failed to list branches, probably not inside a git repository
        return 1
    fi

    local branch
    branch=$(echo -n "$branches" | pipedial --title 'Pick destination branch:')
    if [ $? -eq 0 ]; then
        git checkout "$branch"
    fi
}

In action

Pipedial Gif