1 ;;; simple.lisp --- Basic usage demonstration program
3 ;; Copyright (C) 2010 Didier Verna
5 ;; Author: Didier Verna <didier@lrde.epita.fr>
6 ;; Maintainer: Didier Verna <didier@lrde.epita.fr>
7 ;; Created: Fri Aug 1 14:45:48 2008
8 ;; Last Revision: Sun Oct 31 14:21:33 2010
10 ;; This file is part of Clon.
12 ;; Clon is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License version 3,
14 ;; as published by the Free Software Foundation.
16 ;; Clon is distributed in the hope that it will be useful,
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details.
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with this program; if not, write to the Free Software
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 ;; Contents management by FCM version 0.1.
30 ;; This demonstration program shows how to define your application's
31 ;; command-line syntax, initialize the library, retrieve option values and
32 ;; generate help strings.
40 #-
(or sbcl cmu ccl ecl
)
41 '(#p
"/usr/local/share/common-lisp/source/asdf/asdf.lisp"))
43 #-asdf2
(setf asdf
:*central-registry
*
44 (list* (merge-pathnames "share/common-lisp/systems/"
45 (user-homedir-pathname))
46 #p
"/usr/local/share/common-lisp/systems/"
47 #p
"/usr/share/common-lisp/systems/"
48 asdf
:*central-registry
*))
50 #-asdf2
(ignore-errors (asdf:operate
'asdf
:load-op
:asdf-binary-locations
))
52 (asdf:operate
'asdf
:load-op
:com.dvlsoft.clon
)
53 (eval-when (:execute
:load-toplevel
:compile-toplevel
) ;; ECL needs this.
54 (com.dvlsoft.clon
:nickname-package
))
56 (clon:defsynopsis
(:postfix
"FILES...")
58 "Demonstration of Clon (use --clon-help for built-in options).")
59 (group (:header
"Flags (non valued options):")
60 (flag :short-name
"h" :long-name
"help"
61 :description
"Print this help and exit."))
62 (group (:header
"Built-in valued option types:")
63 (group (:header
"String options:")
64 (stropt :short-name
"n" :long-name
"name"
65 :description
"Set your name to NAME."
66 :argument-name
"NAME"))
67 (group (:header
"Lisp objects:")
68 (lispobj :short-name
"e" :long-name
"eval"
69 :description
"Evaluate EXPR."
70 :argument-name
"EXPR"))
71 (group (:header
"Enumerations:")
72 (enum :long-name
"copyright"
73 :description
"Set the copyright to LICENSE.
74 Possible values are: none, gpl, lppl, bsd or mit."
75 :argument-name
"LICENSE"
76 :argument-type
:optional
77 :enum
'(:none
:gpl
:lppl
:bsd
:mit
)
79 :default-value
:none
))
80 (group (:header
"Path options:")
81 (path :long-name
"tmpdir"
82 :description
"Set the temporary directory to DIR."
85 :default-value
#p
"/tmp/")
86 (path :short-name
"o" :long-name
"output"
87 :description
"Output to FILE."
90 :default-value
#p
"a.out")
92 :description
"Set the include search path to SEARCH-PATH.
93 SEARCH-PATH is a colon-separated list of directories. Use an empty argument to
94 remove all search paths."
95 :argument-name
"SEARCH-PATH"
97 :default-value
'(#p
"/usr/local/share/" #p
"/usr/share/")))
98 (group (:header
"Switches:")
99 (switch :short-name
"d" :long-name
"debug"
100 :description
"Turn debugging on or off."
101 :argument-style
:on
/off
103 (group (:header
"Extended switches:")
104 (xswitch :short-name
"c" :long-name
"connect"
105 :description
"Connect to server.
106 Possible values are yes, no or try. If try, no errors are reported."
110 "Entry point for the standalone application."
112 (cond ((clon:getopt
:short-name
"h")
115 (format t
"Program name: ~A~%~%" (clon:progname
))
116 (format t
"Options:")
117 (clon:do-cmdline-options
(option name value source
)
118 (print (list option name value source
)))
120 (format t
"Remainder: ~A~%" (clon:remainder
))))
123 (clon:dump
"simple" #'main
)
126 ;;; simple.lisp ends here