fcli (formerly FossilApp) provides a small framework for bootstrapping simple libfossil applications which only need a single fsl_cx instance managing a single checkout and/or repository.
It is primarily intended for use with CLI apps implementing features similar to those in fossil(1), but can also be used with GUI apps. It provides the following basic services to applications:
- The global fcli struct holds global state.
- fcli_setup_v2() bootstraps the environment. This must be the first call made into the API, as this replaces the libfossil memory allocator with a fail-fast variant to simplify app-level code a bit (by removing the need to check for OOM errors). This also registers an atexit(3) handler to clean up fcli-owned resources at app shutdown.
- Automatically tries to open a checkout (and its associated repository) under the current directory, but not finding one is not an error (the app needs to check for this if it should be an error: use fsl_cx_db_repo() and fsl_cx_db_ckout()).
- fcli_flag(), fcli_next_arg(), and friends provide uniform access to CLI arguments.
- A (very) basic help subsystem, triggered by the –help or -? CLI flags, or if the first non-flag argument is "help". Applications may optionally assign fcli.appHelp to a function which outputs app-specific help.
- Basic error reporting mechanism. See fcli_err_report().
The source tree contains several examples of using fcli in the files named f-*.c.