Continuing the work we did in the previous chapter, we’ll write a CLI tool for the API service we wrote. Using a CLI tool, we’ll demonstrate another way to interact asynchronously in Rust by making HTTP requests with a separate service (which we also wrote). Our CLI tool will provide a convenient way to interact with our todo app backend (the API service). We’ll use Rust’s async features to showcase the basics of writing async Rust from the client side of a client-server relationship.
Writing CLI tools is one way to use software to solve problems for us, and building tools is how we avoid repetition, mistakes, and time wasted doing tasks computers are better suited for. Most versions of the Unix philosophy (which has several variations) include the “do one thing and do it well” tenet, which we’ll apply to our CLI tool. We’ll also make it easy to pipe the output from our CLI into another tool (another point from the Unix philosophy), making it possible to string commands together.