Finalize support for restricted mode option.
[clon.git] / src / options / flag.lisp
blobf6666de59e42bfafed3066101765ba95739647f0
1 ;;; flag.lisp --- Flag options
3 ;; Copyright (C) 2010, 2011, 2012 Didier Verna.
5 ;; Author: Didier Verna <didier@lrde.epita.fr>
6 ;; Maintainer: Didier Verna <didier@lrde.epita.fr>
8 ;; This file is part of Clon.
10 ;; Permission to use, copy, modify, and distribute this software for any
11 ;; purpose with or without fee is hereby granted, provided that the above
12 ;; copyright notice and this permission notice appear in all copies.
14 ;; THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
15 ;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
16 ;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
17 ;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
18 ;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
19 ;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
20 ;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 ;;; Commentary:
25 ;; Contents management by FCM version 0.1.
28 ;;; Code:
30 (in-package :com.dvlsoft.clon)
31 (in-readtable :com.dvlsoft.clon)
34 ;; ==========================================================================
35 ;; The Flag Class
36 ;; ==========================================================================
38 (defclass flag (option)
40 (:documentation "The FLAG class.
41 This class implements options that don't take any argument."))
45 ;; ==========================================================================
46 ;; Flag Instance Creation
47 ;; ==========================================================================
49 (defun make-flag (&rest keys &key short-name long-name description env-var
50 hidden)
51 "Make a new flag.
52 - SHORT-NAME is the option's short name (without the dash).
53 It defaults to nil.
54 - LONG-NAME is the option's long name (without the double-dash).
55 It defaults to nil.
56 - DESCRIPTION is the option's description appearing in help strings.
57 It defaults to nil.
58 - ENV-VAR is the flag's associated environment variable.
59 It defaults to nil.
60 - When HIDDEN, the option doesn't appear in help strings."
61 (declare (ignore short-name long-name description env-var hidden))
62 (apply #'make-instance 'flag keys))
64 #i(make-internal-flag 2)
65 (defun make-internal-flag (long-name description
66 &rest keys &key env-var hidden)
67 "Make a new internal (Clon-specific) flag.
68 - LONG-NAME is the flag's long-name, sans the 'clon-' prefix.
69 (Internal options don't have short names.)
70 - DESCRIPTION is the flag's description.
71 - ENV-VAR is the flag's associated environment variable, sans the 'CLON_'
72 prefix. It default to nil.
73 - When HIDDEN, the option doesn't appear in help strings."
74 (declare (ignore env-var hidden))
75 (apply #'make-instance 'flag
76 :long-name long-name
77 :description description
78 :internal t
79 keys))
82 ;;; flag.lisp ends here