YoVDO

Creating a Digital Garden CLI with Rust

Offered By: egghead.io

Tags

Rust Courses File Handling Courses Integration Testing Courses Cargo Courses

Course Description

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

Related Courses

Intermediate Rust Programming and Advanced Concepts
Packt via Coursera
RESTful API with Rust: Build a Game Map Server
Coursera Project Network via Coursera
Rust Essential Training
LinkedIn Learning
Packages, Crates, and Modules in Rust
Pluralsight
Rust Secret Cipher CLI
Duke University via Coursera