Line Select

March 31, 2026 · View on GitHub

CI Crates.io CI

Elevate your command-line pipelines using the Interactive Line Selector – a potent utility enabling interactive line selection from stdin. Seamlessly integrate, pause, select, and refine your pipeline, enhancing data processing precision.

Features

  • Interactive Selection: Pause the pipeline's execution to manually select specific lines from the input stream.
  • Seamless Integration: Easily integrate the Interactive Line Selector into your existing command-line pipelines.
  • Optimized Workflow: Curate data on-the-fly for more accurate and meaningful results.

Usage

Incorporate the Interactive Line Selector into your pipeline:

<command producing input> | lineselect | <subsequent command>

Use arrow keys to navigate, press Space to select/deselect lines, and press Enter to proceed with the selected lines.

Options

OptionShortDescriptionDefault
--prompt <TEXT>-pCustom prompt textPick some lines
--max-height <N>Maximum number of lines to display at once(all lines)
--version-VPrint version
--help-hPrint help

Exit Codes

CodeMeaning
0Lines selected and printed, or empty input
1User cancelled (Esc or Ctrl+C)

Example

Imagine you have a list of files in a directory and you want to selectively remove them using rm. Instead of using a complex find command, you can utilize the Interactive Line Selector to streamline the process:

ls | lineselect | xargs rm

Example

Use a custom prompt to make scripts more descriptive:

git branch | lineselect --prompt "Pick branches to delete" | xargs git branch -d

Limit the visible lines when working with large inputs:

cat large_file.txt | lineselect --max-height 10 | xargs process

Check the exit code to detect cancellation in scripts:

if ! selected=$(ls | lineselect); then
  echo "Selection cancelled"
fi

Installation

Cargo (Linux, Mac, Windows)

cargo install lineselect

Debian / Ubuntu

Download the .deb for your architecture from the latest release and install it:

apt install ./lineselect_*.deb

RPM (Fedora / RHEL / openSUSE)

Download the .rpm for your architecture from the latest release and install it:

rpm -i lineselect-*.rpm

Contributions

Contributions are welcome! If you have ideas for improvements or new features, please feel free to submit a pull request.

Acknowledgments

This project builds upon the fantastic work of the following projects:

  • Clap - A full featured, fast Command Line Argument Parser for Rust.
  • Dialoguer - Rust utility library for nice command line prompts and similar things.

Previous Implementation

This idea has been implemented before by chfritz/lineselect using JavaScript. Our project aims to provide an option in Rust with a single binary.

License

This project is licensed under the MIT License - see the LICENSE file for details.