Skip to content

2. Build a command-line application

Create the next project in the Archer story:

Terminal window
longbow new archer-greet
cd archer-greet

Its only command accepts one name. This keeps parsing at the entry point and makes every outcome observable through stdout, stderr, and the exit status.

src/main.fl
module main;
@imports
:: lib::std::fmt
:: lib::std::os::arguments;
i32 main() {
values, captureError := arguments::capture();
if captureError != none {
fmt::eprintln("archer-greet: cannot capture arguments");
return 3;
}
if values.len() != 2 {
fmt::eprintln("usage: archer-greet <name>");
return 2;
}
fmt::println("Welcome, ", values[1].view(), "!");
return 0;
}
Terminal window
longbow check
longbow run -- Fauna
Welcome, Fauna!

Longbow forwards values after -- without a shell and returns the program’s status. The qualified fixture also runs with no name and verifies status 2 and the exact usage diagnostic.