O'Reilly logo

The Cucumber Book, 2nd Edition by Steve Tooke, Aslak Hellesoy, Matt Wynne

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Simple Interfaces

The beauty of command-line applications is that they all have the same simple interface, as shown in the following figure. 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:

images/cli-simple-interface.png
 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required