Simple Interfaces

The beauty of command-line applications is that they all have the same simple interface, as shown in Figure 16, Command-line applications all use the same simple interface. They can read from standard input (STDIN) and write to standard output (STDOUT). When something goes wrong, they sometimes write to standard error (STDERR). In addition to using those three streams, command-line applications can accept arguments on the command line, which in Ruby end up in the ARGV constant. Consider the following command:

 
cp foo.txt bar.txt

Here, the two command-line arguments foo.txt and bar.txt are passed to the cp command-line application.

When a command-line application is done and exits, it reports how the execution went with ...

Get The Cucumber Book now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.