nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b4e7c5d
)
opts: added possibility to hide an option from the usage (easter egg?)
author
Maxime Leroy
<maxime.leroy76@gmail.com>
Thu, 26 Jun 2014 19:14:07 +0000
(15:14 -0400)
committer
Jean Privat
<jean@pryen.org>
Wed, 23 Jul 2014 01:33:29 +0000
(21:33 -0400)
Signed-off-by: Maxime Leroy <maxime.leroy76@gmail.com>
lib/opts.nit
patch
|
blob
|
history
diff --git
a/lib/opts.nit
b/lib/opts.nit
index
97a2a1f
..
20bf42f
100644
(file)
--- a/
lib/opts.nit
+++ b/
lib/opts.nit
@@
-31,6
+31,9
@@
abstract class Option
# Is this option mandatory?
var mandatory: Bool writable = false
+ # Is this option hidden from `usage`?
+ var hidden: Bool writable = false
+
# Has this option been read?
var read: Bool writable = false
@@
-276,9
+279,11
@@
class OptionContext
end
if lmax < l then lmax = l
end
-
+
for i in options do
- print(i.pretty(lmax))
+ if not i.hidden then
+ print(i.pretty(lmax))
+ end
end
end