Interacting with the environment
To interact with the environment, we must manage two things. First, we need to load, save, and edit the state of to-do items. Second, we also must accept user input to edit and display data. Our program can achieve this by running the following steps for each process:
- Collect arguments from the user.
- Define a command (
get
,edit
,delete
, andcreate
) and define a to-do title from commands being passed into the application. - Load a JSON file that stores the to-do items from previous runs of the program.
- Run a
get
,edit
,delete
, orcreate
function based on the command passed into the program, saving the result of the state in a JSON file at the end.
We can start making this four-step process possible by initially loading our state with the serde
crate.
Reading and writing JSON files
We are now at the stage where we are going to persist data in the form of a JSON file. We will upgrade this to a proper database in Chapter...