Add missing eval-when clause.
[clon.git] / README
blobe6a930f5bf5d94b0ff9125aa168d2a5716599bf0
1                                                              -*- outline -*-
3 * Introduction
5 In the Lisp family of languages, one of the key components is the so-called
6 REPL, the Read-Eval-Print Loop, which blends the runtime, compilation and
7 development phases together, allowing for a very high level of interaction
8 with the program. The importance of this paradigm explains why it is still
9 rare to find "standalone" applications written in Lisp: most Lisp application
10 clients are lispers themselves, and they prefer to live in the REPL.
12 On the other hand, many contemporary Common Lisp compilers provide ways of
13 creating standalone Common Lisp programs, using either shebang technology or
14 by directly dumping executables. This process is getting easier to achieve
15 every day. For instance, with SBCL, all it takes is one function call
16 (save-lisp-and-die) and one command-line option to the compiler (--script).
18 The (big) size of a Lisp image has been considered a showstopper in creating
19 standalone applications for a long time, but nowadays, it doesn't really
20 matter anymore (if you are not convinced, just figure out the average size of
21 an application bundle under Mac OS X). This, along with the fact that Common
22 Lisp compilers can generate very efficient code today, makes the perspective
23 of standalone Common Lisp applications very tempting again.
25 When it comes to preserving interaction with the user, one of the key
26 components in a standalone application is the handling of the command-line. 
27 Clon is a library designed to do just that. As far as we know, there might be
28 only one other competitor on this market for the Common Lisp language.
31 * Overview
32 Clon provides traditional features one might expect from a command-line
33 options management library, but what makes it somewhat unique in its
34 conception is that it has been designed with both the application developer
35 and the application user in mind: many aspects of the command-line management
36 usually imposed by the program are in fact under the control of the
37 application user. The idea is that all Clon-enabled applications behave in a
38 uniform way, and that it is the user who gets to decide, not the developper. 
39 The most important features of Clon are listed below.
41 ** Command-Line Syntax
42 Clon imposes a particular yet flexible syntax for the command-line. Options
43 have short and/or long names, beginning with either one or two dashes. Options
44 may take an argument. In that case, the argument may be optional or mandatory. 
45 Option names may be abbreviated and one-character options may be grouped
46 together in a single call. There is an additional call syntax for Boolean or
47 Boolean-based options. Finally, the command-line may have a "postfix", that
48 is, a non-option part.
50 ** Option Types
51 Clon comes with a set of predefined option types, including "flags" (option
52 without arguments), "switches" (Boolean options), simple Lisp objects, simple
53 strings, enumerations, pathnames etc. Clon is also extensible: it is possible
54 to define new option types, either from scratch or by subclassing an existing
55 one.
57 ** Value Retrieval
58 The traditional approach to command-line analysis is to process it
59 sequentially, and Clon lets you do that. However, Clon also provides an
60 explicit retrieval mechanism by which you can directly request the value of a
61 specific option, regardless of its position, or even its presence on the
62 command-line. An option's value can be retrieved from different sources: a
63 command-line argument, a "fallback" value (for optional arguments), a default
64 value or an environment variable associated with the option. The retrieval
65 process is completely automated, hence removing this burden from the
66 developer's shoulders.
68 ** Error Management
69 Another cumbersome task already taken care of is error management. Clon
70 provides two built-in error management schemes, in case something is wrong on
71 the command-line. The simplest one is to quit the application with an
72 informative error message. The other one is to enter an interactive dialog
73 with the user, in which it is possible to fix the problem (correct a typo,
74 discard an option call, provide a missing argument or value etc.). A unique
75 feature of Clon is that the application user may choose his or her preferred
76 error management scheme.
78 ** Help String Contents
79 The "help string" is typically what you expect from the output of a --help
80 option. Maintaining an up-to-date help string is a very boring task, so Clon
81 completely automates this for you (another burden removed from the developer's
82 shoulders). However, the application programmer still has control over the
83 help string's contents, notably the order in which options are displayed, and
84 also by having the possibility of grouping options together and inserting
85 arbitrary text in the output.
87 ** Help String Format
88 Clon also completely automates the help string typesetting process. For
89 instance, it can automatically format the output for 80 columns, but it is
90 also aware of the tty geometry and will use it when appropriate. Clon also
91 supports help string "fontification" (or "highlighting") through ISO/IEC 6429
92 SGR escape sequences on tty's that support it. Another unique feature of Clon
93 is that the exact format and highlight specification for the help string is
94 under the control of the application user, via the notion of "theme". Clon
95 comes with a set of predefined themes (for instance, standard, with heavy
96 fontification, refcard for quick reference etc.) and application users can
97 define their own. As a matter of fact, a theme not only controls the format
98 and highlight of the help string, but also its contents.