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

Build a Simple Dynamic Site with Node.js Course (How To)
Treehouse
Introducción a la programación en Python I: Aprendiendo a programar con Python
Pontificia Universidad Católica de Chile via Coursera
Excel/VBA for Creative Problem Solving, Part 2
University of Colorado Boulder via Coursera
Python Functions, Files, and Dictionaries
University of Michigan via Coursera
Estructuras de datos en Python
Universidad Austral via Coursera