Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

egghead.io

Creating a Digital Garden CLI with Rust

via egghead.io

Overview

In this course, Chris takes a README-driven approach to build out a Rust CLI that supports content authoring for a digital garden.
Specifically, you'll work through the first command for the CLI, writing files. You start by initializing a new Cargo binary crate by creating the write command that allows you to create files (and their contents) to the folder that you set.

Syllabus

  • README-driven planning for a Digital Garden CLI in Rust
  • Initialize a new Cargo binary crate in a new package
  • Rename the default Cargo binary to be different than the package name
  • Using the todo macro to typecheck unwritten code that will be implemented in the future
  • Using color_eyre and distributed tracing to yield better error messages to the user
  • Setting up git-like subcommands using structopt
  • Documenting and writing helptext for Structopt CLI commands and flags
  • Integration testing Cargo binaries with assert_cmd
  • Matching structopt commands and using Rust values after move
  • Creating a library crate to support a Rust binary crate in the same package
  • Adding support for global flags that apply for all subcommands with structopt
  • Passing control to the user's favorite editor (such as VSCode) from the CLI
  • Using the Option type in Rust to pick from multiple values that might not exist
  • Prompting the user for input with rprompt and loop
  • Checking for file existence with PathBuf to ensure unique filenames
  • Using owo_colors Extension Traits to colorize terminal output
  • Using assert_fs and predicates to integration test with a real temporary file system
  • Abstracting test utilities inside integration test files

Taught by

Chris Biscardi

Reviews

4.7 rating at egghead.io based on 22 ratings

Start your review of Creating a Digital Garden CLI with Rust

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.