CLI Shell Completions in Rust

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • clap-rs

    A full featured, fast Command Line Argument Parser for Rust

  • I've got great news. Adding/supporting shell completions with your Rust based CLI is very easy! Using the clap crate, we can generate shell completion scripts either at compile time, or provide a special option to allow users to generate shell completion scripts at run time on the fly.

  • ripgrep

    ripgrep recursively searches directories for a regex pattern while respecting your gitignore

  • Before I said that creating shell completion scripts was hard, but how hard? A popular command line tool ripgrep which has a moderately large CLI space (not huge, but not trivial either) has a Bash completion script that is 213 lines lone (as of v12.1.1)! That's just Bash. Other shells have similarly sized scripts. rustup which has a fairly large CLI space has a 1,110 line Bash script.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • grab-xkcd

    Downloads an XKCD comic

  • We'll be updating our grab-xkcd program from a previous post with the new code, but in order to clearly demonstrate the different methods and not conflict with the original article I will use two new branches completions-ct for compile time completions, and completions-rt for run time completions. If the reader is feeling froggy, you can combine the two!

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts