Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

cliq Usage Examples

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

Simple (simple)

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

Default Values (defaultValues)

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!

Auto Help (autoHelp)

Demonstrates how to automatically generate the --help flag and its output.

Full auto :P (auto())

$ ./bin/autoHelp --help
Flags:
   --test   bool
   --help   bool
$ ./bin/autoHelp --test
Test flag is set!
$ ./bin/autoHelp
Test flag is not set!

Manual (manual())

$ ./bin/autoHelp --help
Flags:
   --help   bool
$ ./bin/autoHelp
Help flag is not set!