1 ;;; demo.lisp --- 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: Sat Jun 12 17:59:07 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.
36 #-asdf2
(setf asdf
:*central-registry
*
38 (merge-pathnames "share/common-lisp/systems/"
39 (user-homedir-pathname))
40 #p
"/usr/local/share/common-lisp/systems/"
41 #p
"/usr/share/common-lisp/systems/"
42 asdf
:*central-registry
*))
44 #-asdf2
(ignore-errors (asdf:operate
'asdf
:load-op
:asdf-binary-locations
))
46 (asdf:operate
'asdf
:load-op
:com.dvlsoft.clon
)
47 (rename-package :com.dvlsoft.clon
48 (package-name :com.dvlsoft.clon
)
49 (adjoin :clon
(package-nicknames :com.dvlsoft.clon
)
50 :test
#'string-equal
))
52 (clon:defsynopsis
(:postfix
"FILES...")
54 "Demonstration of Clon (use --clon-help for built-in options).")
55 (group (:header
"Flags (non valued options):")
56 (flag :short-name
"h" :long-name
"help"
57 :description
"Print this help and exit."))
58 (group (:header
"Built-in valued option types:")
59 (group (:header
"String options:")
60 (stropt :short-name
"n" :long-name
"name"
61 :description
"Set your name to NAME."
62 :argument-name
"NAME"))
63 (group (:header
"Lisp objects:")
64 (lispobj :short-name
"e" :long-name
"eval"
65 :description
"Evaluate EXPR."
66 :argument-name
"EXPR"))
67 (group (:header
"Enumerations:")
68 (enum :long-name
"copyright"
69 :description
"Set the copyright to LICENSE.
70 Possible values are: none, gpl, lppl, bsd or mit."
71 :argument-name
"LICENSE"
72 :argument-type
:optional
73 :enum
'(:none
:gpl
:lppl
:bsd
:mit
)
75 :default-value
:none
))
76 (group (:header
"Path options:")
77 (path :long-name
"tmpdir"
78 :description
"Set the temporary directory to DIR."
81 :default-value
#p
"/tmp/")
82 (path :short-name
"o" :long-name
"output"
83 :description
"Output to FILE."
86 :default-value
#p
"a.out")
88 :description
"Set the include search path to SEARCH-PATH.
89 SEARCH-PATH is a colon-separated list of directories. Use an empty argument to
90 remove all search paths."
91 :argument-name
"SEARCH-PATH"
93 :default-value
'(#p
"/usr/local/share/" #p
"/usr/share/")))
94 (group (:header
"Switches:")
95 (switch :short-name
"d" :long-name
"debug"
96 :description
"Turn debugging on or off."
97 :argument-style
:on
/off
99 (group (:header
"Extended switches:")
100 (xswitch :short-name
"c" :long-name
"connect"
101 :description
"Connect to server.
102 Possible values are yes, no or try. If try, no errors are reported."
106 "Entry point for the standalone application."
108 (cond ((clon:getopt
:short-name
"h")
111 (format t
"Program name: ~A~%~%" (clon:progname
))
112 (format t
"Options:")
113 (clon:do-cmdline-options
(option name value source
)
114 (print (list option name value source
)))
116 (format t
"Remainder: ~A~%" (clon:remainder
))))
120 (save-lisp-and-die "simple"
121 :toplevel
#'main
:executable t
:save-runtime-options t
)
124 ;;; demo.lisp ends here