This directory contains examples of how to use the cliq library.
You can compile all the examples using:
$ make examples
Executables will be placed in the examples/bin
directory.
You can also run the examples using:
$ make run-examples
Demonstrates how to create a simple CLI application with custom arguments.
$ ./bin/simple
No flags are set!
$ ./bin/simple --version
Version flag is set!
$ ./bin/simple --test
error: [--test] requires a value
Try `--help` for more information.
$ ./bin/simple --test 'hello world'
received: hello world
Demonstrates how to set default values for arguments with --test
being true
and --version
being false
by default.
$ ./bin/defaultValues
Test flag is set!
$ ./bin/defaultValues --notest
No flags are set!
$ ./bin/defaultValues --test
Test flag is set!
Demonstrates how to automatically generate the --help
flag and its output.
$ ./bin/autoHelp --help
Flags:
--test bool
--help bool
$ ./bin/autoHelp --test
Test flag is set!
$ ./bin/autoHelp
Test flag is not set!
$ ./bin/autoHelp --help
Flags:
--help bool
$ ./bin/autoHelp
Help flag is not set!