# A Real Command-Line App

The parts every real command-line application has: options, subcommands, a place for its data, and friendly output.

Updated: November 10, 2026

## [The Shape of an App](https://www.ask-codey.com/courses/bash-in-depth/topics/bash-the-shape-of-an-app)

1. [Options and Flags: getopts and --help](https://www.ask-codey.com/lessons/bash-options-with-getopts) (Journeyman): getopts reads a script's one-letter options in any order, flags and options with a value alike, and a real tool also answers --help with a help page and --version with its version number.
2. [Subcommands: app add, app list](https://www.ask-codey.com/lessons/bash-subcommands) (Freelancer): A tool that does several jobs gives each job a word of its own, a subcommand, as git and docker do: a case on the first argument picks the job, shift drops that word, and one function per subcommand does the work.
3. [Where an App Keeps Its Data](https://www.ask-codey.com/lessons/bash-app-data-and-config) (Journeyman): An app keeps its data in ~/.local/share and its settings in ~/.config, whatever folder you run it from, makes those folders and files itself on its first run, and loads its settings file with source.

## [Friendly Output](https://www.ask-codey.com/courses/bash-in-depth/topics/bash-friendly-output)

1. [Friendly Output: Columns and Colors](https://www.ask-codey.com/lessons/bash-friendly-output) (Journeyman): printf lines output up in columns, with a width for every blank it fills, and tput adds bold and color, but only when \[\[ -t 1 \]\] says the output is going to a terminal, so files and pipes get plain text.

## [Exercise: A Recipe Box App](https://www.ask-codey.com/courses/bash-in-depth/topics/exercise-bash-a-recipe-box-app)

1. [Exercise: A Recipe Box App](https://www.ask-codey.com/lessons/exercise-bash-a-recipe-box-app) (Freelancer): Finish recipes, a whole command-line application in bash, with add and list subcommands, getopts options, a help page and a version, its recipes in ~/.local/share and its settings in ~/.config made on the first run, columns, and color only on a terminal, while a check script runs it job by job.

Source: https://www.ask-codey.com/courses/bash-in-depth/chapters/bash-a-real-command-line-app
