singularity

Chapter 12: An I/O Project: Building a Command Line Program

Accepting Command Line Arguments

Reading the Argument Values

Saving the Argument Values in Variables

Reading a File

Refactoring to Improve Modularity and Error Handling

Separation of Concerns for Binary Projects

Fixing the Error Handling

Extracting Logic from main

Splitting Code into a Library Crate

Developing the Library’s Functionality with Test-Driven Development

Writing a Failing Test

Writing Code to Pass the Test

Working with Environment Variables

Writing a Failing Test for the Case-Insensitive Search Function

Implementing the search_case_insensitive Function

Writing Error Messages to Standard Error Instead of Standard Output

Checking Where Errors Are Written

Printing Errors to Standard Error