Browse documentation

Overview

Overview

Start here

Your first CLIRunnable examplesGuide index

How do I...?

Common recipesShell completionProject generator

Learn

Commands and subcommandsOptions and validationOutput, errors, and progress

Reference

Public APICurrent limitations

Inside cli-fp

Technical design

Project

Contributing and support

Runnable examples

The repository examples are ordinary Free Pascal programs. They are the quickest way to compare the three command shapes before choosing an API:

Build an example

Run these commands from a clone of the repository. The tested compiler is FPC 3.2.2; Lazarus is optional.

fpc -Fu./src -FE./example-bin ./examples/RootCommandDemo/RootCommandDemo.lpr
./example-bin/RootCommandDemo --help

On Windows, quote the unit path so PowerShell passes it to FPC as one option:

fpc "-Fu.\src" "-FE.\example-bin" .\examples\RootCommandDemo\RootCommandDemo.lpr
.\example-bin\RootCommandDemo.exe --help

The repository's example build scripts compile all eight canonical examples. Individual source files remain in the repository so you can copy a small working program and change it directly.

Choose by goal

ExampleShows
QuickStartDemoThe homepage's smallest compiling root CLI
RootCommandDemoA focused default action and root options
SimpleDemoNamed commands, options, output and a spinner
SubCommandDemoNested command trees and completion
ColorDemoColours and terminal presentation
ProgressDemoSpinners and progress bars
LongRunningOpDemoLonger operations and cleanup
ErrorHandlingDemoErrors and exit behaviour

The cleanup smoke checks compile all eight examples on Windows and Linux, including QuickStartDemo. For the API decision behind root, named, and nested commands, continue with commands.