Getting Started with CLI tools in Rust using Clap

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

  • We can also use tuple-like struct syntax and named-field struct syntax for enum variants within our enum; this is because unlike in other OOP languages, Rust enums are actually sum types. You can read more about how powerful Rust enums are in another article we wrote here. You can have optional arguments by simply wrapping the types in Option, but if you want to add a flag to a command you can use bool, since clap recognises that flags are either there or not there. Let's have a look at what this might look like:

  • comfy-table

    :large_orange_diamond: Build beautiful terminal tables with automatic content wrapping

  • comfy-table is a crate designed to facilitate tables that look pretty in the terminal. You can get started in as little as this:

  • 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
  • inquire

    A Rust library for building interactive prompts

  • inquire is a crate designed for building interactive prompts on the terminal. It supports single-select, multi-select, calendar picking, and more:

  • shuttle

    Build & ship backends without writing any infrastructure files.

  • cargo-shuttle is Shuttle's own CLI for interacting with the Shuttle platform. Within the src folder, you will be able to get a better sense of how you can organise your folders/files for a larger CLI project for a live service. There is also use of async here with tokio, so if you're interested in learning how to get started with using clap with async services (for example setting up an async client for a database service), this would be a perfect opportunity to learn to do so!

  • git-cliff

    A highly customizable Changelog Generator that follows Conventional Commit specifications ⛰️

  • git-cliff is a terminal tool that can generate changelog from the Git history by using conventional commits, as well as by using regex-powered parsers and you can even change the changelog template itself by using a configuration file. This tool is a great example of text parsing on the terminal and also uses clap_mangen which generates man pages. Useful for anyone who is serious about looking into making a production-ready terminal tool!

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
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