dracula 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -9
- data/lib/dracula/command_help.rb +5 -1
- data/lib/dracula/flag.rb +5 -5
- data/lib/dracula/structure.rb +3 -2
- data/lib/dracula/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a922140df506eabf4ef3525ffcdf09b708162bf6
|
4
|
+
data.tar.gz: 1bcf05a92463bd15fb9c075c64be17609aea8a52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9db38eaa23e7a55a3f7bb94bfaa6670c27142e1653d5ce3993a137412ca2eb6631efebad6f99c3b5694d1b47ea364c3f4b031d71732c9695a59bc1b674693c20
|
7
|
+
data.tar.gz: 72dddca965e86b9fc08fc756b5f03e3d080518ac52138e32549da8b318f2b320b93b38abc14535205d474acfe650ea6dc06da97aa1639dad14f310c32770c258
|
data/README.md
CHANGED
@@ -48,9 +48,9 @@ Hi dracula!
|
|
48
48
|
|
49
49
|
Every method in your class represents a command.
|
50
50
|
|
51
|
-
## Command line
|
51
|
+
## Command line flags
|
52
52
|
|
53
|
-
A command can have one or more command line
|
53
|
+
A command can have one or more command line flags.
|
54
54
|
|
55
55
|
``` ruby
|
56
56
|
class CLI < Dracula
|
@@ -72,11 +72,11 @@ $ cli hello --name "Peter"
|
|
72
72
|
Hi Peter!
|
73
73
|
```
|
74
74
|
|
75
|
-
The
|
75
|
+
The flags are defined above the method.
|
76
76
|
|
77
77
|
#### Default values
|
78
78
|
|
79
|
-
|
79
|
+
flags can have default values:
|
80
80
|
|
81
81
|
``` ruby
|
82
82
|
class CLI < Dracula
|
@@ -230,7 +230,7 @@ CLI.docs
|
|
230
230
|
:desc => "Log in to the cli",
|
231
231
|
:long_desc => "Log in to the app from the command line.\n",
|
232
232
|
:shell => "git login --username USERNAME --password PASSWORD",
|
233
|
-
:
|
233
|
+
:flags => [
|
234
234
|
{ :name => "username", :required => true, :type => "string", :alias => "u", :default => nil },
|
235
235
|
{ :name => "password", :required => true, :type => "string", :alias => "p", :default => nil },
|
236
236
|
{ :name => "verbose", :required => false, :type => "boolean", :alias => "v", :default => false }
|
@@ -247,14 +247,14 @@ CLI.docs
|
|
247
247
|
:long_desc => "",
|
248
248
|
:desc => "List teams in an organization",
|
249
249
|
:shell => "git teams:list ORG",
|
250
|
-
:
|
250
|
+
:flags => []
|
251
251
|
},
|
252
252
|
{
|
253
253
|
:name => "info",
|
254
254
|
:long_desc => "",
|
255
255
|
:desc => "Show info for a team",
|
256
256
|
:shell => "git teams:info TEAM",
|
257
|
-
:
|
257
|
+
:flags => []
|
258
258
|
}
|
259
259
|
],
|
260
260
|
|
@@ -267,14 +267,14 @@ CLI.docs
|
|
267
267
|
:long_desc => "",
|
268
268
|
:desc => "Add a project to the team",
|
269
269
|
:shell => "git teams:projects:add TEAM PROJECT",
|
270
|
-
:
|
270
|
+
:flags => []
|
271
271
|
},
|
272
272
|
{
|
273
273
|
:name => "list",
|
274
274
|
:desc => "List projects in a team",
|
275
275
|
:long_desc => "",
|
276
276
|
:shell => "git teams:projects:list TEAM",
|
277
|
-
:
|
277
|
+
:flags => []
|
278
278
|
}
|
279
279
|
],
|
280
280
|
|
data/lib/dracula/command_help.rb
CHANGED
@@ -43,7 +43,11 @@ class Dracula
|
|
43
43
|
def show_flags
|
44
44
|
puts Dracula::UI.bold("Flags:")
|
45
45
|
|
46
|
-
@command.flags.
|
46
|
+
flags = @command.flags.map do |flag|
|
47
|
+
[flag.banner, flag.description]
|
48
|
+
end
|
49
|
+
|
50
|
+
Dracula::UI.print_table(flags, :indent => 2)
|
47
51
|
|
48
52
|
puts ""
|
49
53
|
end
|
data/lib/dracula/flag.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
class Dracula
|
2
2
|
class Flag < Struct.new(:name, :params)
|
3
3
|
|
4
|
+
def description
|
5
|
+
params[:desc]
|
6
|
+
end
|
7
|
+
|
4
8
|
def type
|
5
9
|
params[:type] || :string
|
6
10
|
end
|
@@ -32,11 +36,7 @@ class Dracula
|
|
32
36
|
alias_method :short_name, :alias_name
|
33
37
|
|
34
38
|
def banner
|
35
|
-
|
36
|
-
"#{short_name_banner}, #{long_name_banner}"
|
37
|
-
else
|
38
|
-
long_name_banner
|
39
|
-
end
|
39
|
+
[short_name_banner, long_name_banner].compact.join(", ")
|
40
40
|
end
|
41
41
|
|
42
42
|
def short_name_banner
|
data/lib/dracula/structure.rb
CHANGED
@@ -23,13 +23,14 @@ class Dracula
|
|
23
23
|
:desc => command.description,
|
24
24
|
:long_desc => command.long_desc.to_s,
|
25
25
|
:shell => command_shell(command),
|
26
|
-
:
|
26
|
+
:flags => command.options.map do |option|
|
27
27
|
{
|
28
28
|
:name => option.name.to_s,
|
29
29
|
:required => option.required?,
|
30
30
|
:type => option.type.to_s,
|
31
31
|
:alias => option.alias_name,
|
32
|
-
:default => option.default_value
|
32
|
+
:default => option.default_value,
|
33
|
+
:desc => option.description.to_s
|
33
34
|
}
|
34
35
|
end
|
35
36
|
}
|
data/lib/dracula/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dracula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Igor Šarčević
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|