libfossil  FossilApp

fcli (formerly FossilApp)

fcli provides a small framework for building applications which work with a single checkout and/or repository database. It provides a number of simplifications/services to applications:

  • Initialization and cleanup of a shared Fossil context and its databases. It automatically opens a checkout under the current directory (like fossil(1) does) unless told not to (via the --no-checkout|-C CLI flags or equivalent C code).
  • Unified CLI argument handling.
  • Optional dispatch-by-command-name support.
  • A basic help system.
  • Installs a memory allocator which crashes on OOM, reducing error checking for this very common use case which very rarely fails in practice (and if it does, you probably have bigger problems than a crashed fossil app).

It is primarily intended for use by test/demo apps but there's little reason it cannot be used with "real" apps as well, and it is generally designed to be agnostic as to the actual type of app it's running under. It uses libfossil's output mechanism for output, so it could just as easily be plugged in to a GUI which directs the output to a text view widget, socket, external application (via a pipe), or similar.

See the f-tools page for a list of apps which demonstrate how to use/abuse fcli.