Command-line arguments
The primary user interface of a CLI application consists of the arguments that can be passed to it on the command line. Before we start exploring the railway CLI project, let us take a brief look at command-line arguments and the mechanisms Python provides for working with them.
Most applications accept various options (or flags) as well as positional arguments. Some applications consist of several sub-commands, each of which has its own distinct set of options and positional arguments.
Positional arguments
Positional arguments represent the main data or objects that the application should operate on. They must be provided in a specific order and are usually not optional. For example, consider the command:
$ cp original.txt copy.txt
This command will create a copy of the file original.txt
, named copy.txt
. Both positional arguments (original.txt
and copy.txt
) are required, and changing their order would change the meaning of the command.