December 2021
Intermediate to advanced
510 pages
11h 20m
English
Good command-line tools interact well with your users, but they also work well with other tools. A common way command-line programs interact with one another is by accepting input from the standard input (STDIN) stream. Let’s add one last feature to the program: the ability to add new tasks via STDIN, allowing your users to pipe new tasks from other command-line tools.
To start this update, add three new libraries to your main.go import list: bufio, io, and strings:
| | import ( |
| » | "bufio" |
| | "flag" |
| | "fmt" |
| | |
| » | "io" |
| | "os" |
| | |
| » | "strings" |
| | |
| | "pragprog.com/rggo/interacting/todo" |
| | ) |
You’ll use the bufio package to read data from the STDIN input stream, the io package to use ...
Read now
Unlock full access