clive 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/clive.gemspec +2 -2
- data/lib/clive.rb +48 -0
- data/lib/clive/command.rb +1 -1
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.5.0
|
data/clive.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{clive}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.5.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Joshua Hawxwell"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-11-16}
|
13
13
|
s.description = %q{Clive is a DSL for creating a command line interface. It is for people who, like me, love OptionParser's syntax and love GLI's commands.}
|
14
14
|
s.email = %q{m@hawx.me}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/clive.rb
CHANGED
@@ -21,6 +21,28 @@ require 'clive/bool'
|
|
21
21
|
# }
|
22
22
|
# end
|
23
23
|
# c.parse(ARGV)
|
24
|
+
# # app -v
|
25
|
+
# #=> {:verbose => true}
|
26
|
+
#
|
27
|
+
# @example Class Style with Inheritence
|
28
|
+
#
|
29
|
+
# opts = {}
|
30
|
+
# class BasicCommands < Clive
|
31
|
+
# switch :basic do
|
32
|
+
# p "basic"
|
33
|
+
# end
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# class SubCommands < BasicCommands
|
37
|
+
# switch :sub do
|
38
|
+
# p "sub"
|
39
|
+
# end
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# SubCommands.parse(ARGV)
|
43
|
+
# # app --basic --sub
|
44
|
+
# #=> "basic"
|
45
|
+
# #=> "sub"
|
24
46
|
#
|
25
47
|
# @example Non-simple Example
|
26
48
|
#
|
@@ -50,6 +72,8 @@ require 'clive/bool'
|
|
50
72
|
# end
|
51
73
|
# end
|
52
74
|
# ARGV = c.parse(ARGV)
|
75
|
+
# # app add framework=blueprint --force --verbose
|
76
|
+
# #=> {:add => {:framework => ['blueprint'], :force => true}, :verbose => true}
|
53
77
|
#
|
54
78
|
class Clive
|
55
79
|
|
@@ -95,4 +119,28 @@ class Clive
|
|
95
119
|
@base.bools
|
96
120
|
end
|
97
121
|
|
122
|
+
# @group Clive Class Methods
|
123
|
+
|
124
|
+
@@base = Clive::Command.new(true)
|
125
|
+
|
126
|
+
def self.flag(*args, &block)
|
127
|
+
@@base.flag(*args, &block)
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.switch(*args, &block)
|
131
|
+
@@base.switch(*args, &block)
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.command(*args, &block)
|
135
|
+
@@base.command(*args, &block)
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.bool(*args, &block)
|
139
|
+
@@base.bool(*args, &block)
|
140
|
+
end
|
141
|
+
|
142
|
+
def self.parse(argv)
|
143
|
+
@@base.run(argv)
|
144
|
+
end
|
145
|
+
|
98
146
|
end
|
data/lib/clive/command.rb
CHANGED
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 5
|
8
|
+
- 0
|
9
|
+
version: 0.5.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Joshua Hawxwell
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-
|
17
|
+
date: 2010-11-16 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|