Rust Cli Boilerplate

screenshot of Rust Cli Boilerplate

Rust project boilerplate for CLI applications

Overview

The Rust CLI Project Template is a base project template designed to facilitate the development of small and reliable utilities in the Rust programming language. It aims to address the challenges of maintaining large projects written in Python by providing stronger compile-time guarantees and reducing friction when transitioning to Rust. The template includes aliases and wrappers for commonly used commands and libraries to improve workflow efficiency.

Features

  • Uses StructOpt for argument parsing, with colorized help output and "Did you mean...?" suggestions enabled.
  • Utilizes the anyhow library for unified error handling.
  • Separates application logic from argument parsing and error handling with the app::main(opts: CliOpts) function.
  • Provides support for generating shell completions using clap's --dump-completions <shell> option.
  • Enables a comprehensive set of rustc and clippy lints without making clippy mandatory.
  • Includes customizable just commands for building, installing, and uninstalling the project, as well as handling dependencies and generating a manpage.
  • Offers a 100% static x86_64 binary option with a small file size.
  • Provides commands for installing project dependencies on Debian-family distros or all distro-agnostic dependencies.
  • Includes a basic .travis.yml file for use with Travis-CI and Nightli.es.
  • Includes a just fmt command that uses the nightly version of rustfmt for access to additional customization options.

Summary

The Rust CLI Project Template addresses the challenges of developing small utilities by providing a base project template in Rust. It offers features such as enhanced argument parsing, unified error handling, and customizable build commands. The template aims to make it easier for developers familiar with Python to transition to Rust, while also improving workflow efficiency and reducing the risk of bugs and errors.