Chapter 11. Writing command-line applications
This chapter covers
- Designing command-line applications by using common conventions
- Communicating with pipes
- Using exit codes
Node command-line utilities are used everywhere, from project automation tools, such as Gulp and Yeoman, to XML and JSON parsers. If you’ve ever wondered how to build command-line tools with Node, this chapter will show you everything you need to know to get started. You’ll learn how Node programs accept command-line arguments and how to handle I/O with pipes. We’ve also included shell tips that will help you use the command line more effectively.
Although writing command-line tools with Node isn’t hard, it’s important to follow community conventions. This chapter includes many of these conventions so you’ll be able to write tools that other people can use, without too much documentation.
A big part of command-line development is understanding the conventions used by established programs. As a real-world example, take a look at Babel: