Recommendations on file/dir/module structure, common dependencies, and/or anti-patterns for writing CLI tool in Rust

This page summarizes the projects mentioned and recommended in the original post on /r/rust

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

    β˜„πŸŒŒοΈ The minimal, blazing-fast, and infinitely customizable prompt for any shell!

  • I'm quite new to Rust, and have been trying to learn more by working on some real solution I could see myself benefitting from, which happens to be a CLI tool at this time. I know there are some great tools written in Rust which I use day to day (such as Starship, bat, exa, etc.), but I wanted to hear experts' suggestions / recommendations on any project I should check out for clean, clear, and extensible structure (or lack thereof), and any dependencies I should start with / avoid.

  • bat

    A cat(1) clone with wings.

  • I'm quite new to Rust, and have been trying to learn more by working on some real solution I could see myself benefitting from, which happens to be a CLI tool at this time. I know there are some great tools written in Rust which I use day to day (such as Starship, bat, exa, etc.), but I wanted to hear experts' suggestions / recommendations on any project I should check out for clean, clear, and extensible structure (or lack thereof), and any dependencies I should start with / avoid.

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

    A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...

  • The main focus of the CLI tool would be around working on filesystem, and also making several network requests simultaneously. Although some may argue it would be easier/faster writing in other languages, this is more for my own learning to write in Rust. It will be a simple toy project at first, but I'd like to prepare for more complex Rust programming in the future with it. For instance, I see different directory / file / module structures used, Rust version / edition differences here and there, some common dependencies such as Tokio, etc.

  • exa

    A modern replacement for β€˜ls’.

  • I'm quite new to Rust, and have been trying to learn more by working on some real solution I could see myself benefitting from, which happens to be a CLI tool at this time. I know there are some great tools written in Rust which I use day to day (such as Starship, bat, exa, etc.), but I wanted to hear experts' suggestions / recommendations on any project I should check out for clean, clear, and extensible structure (or lack thereof), and any dependencies I should start with / avoid.

  • flux2

    Open and extensible continuous delivery solution for Kubernetes. Powered by GitOps Toolkit.

  • Flux CLI (for Flux, GitOps) for Cobra based implementation with a clean and extensible setup

  • cobra

    A Commander for modern Go CLI interactions

  • Flux CLI (for Flux, GitOps) for Cobra based implementation with a clean and extensible setup

  • cli

    GitHub’s official command line tool

  • I personally prefer GitHub CLI implementation over Flux's, as the most of the implementation details are handled in separate, "internal" packages, making their responsibilities clear

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

    A simple zero-config tool to make locally trusted development certificates with any names you'd like.

  • mkcert for small dependency footprint - a bit more lengthy implementation but the code base is easy enough to follow

  • kubectl

    Issue tracker and mirror of kubectl code

  • kubectl is for sure battle tested, but it involves very Kubernetes specific implementations and is going to be too complicated for the first pointer

  • glow

    Render markdown on the CLI, with pizzazz! πŸ’…πŸ»

  • Charm's Glow is a joy to use, a good example of having the Charm's Bubbletea usage - but from the code perspective, it's a bit difficult to navigate as many code paths are put in the same package

  • bubbletea

    A powerful little TUI framework πŸ—

  • Charm's Glow is a joy to use, a good example of having the Charm's Bubbletea usage - but from the code perspective, it's a bit difficult to navigate as many code paths are put in the same package

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