The Command Line
The Command Line: Arguments, Exit Codes and Clear Errors, Settings from Environment Variables.
Updated
- Arguments, Exit Codes and Clear Errors (Apprentice): A command-line tool reads the words typed after it with process.argv and util.parseArgs, prints a --help line, sends errors to console.error with a message a person can act on, and sets process.exitCode so the computer that ran it knows whether it worked.
- Settings from Environment Variables (Apprentice): A setting that changes from one computer to another, such as where a data folder is, belongs in an environment variable, which a Node program reads from process.env with a default from ??, and which comes from the terminal or from an .env file loaded with node --env-file.