claide 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/claide.rb +1 -1
- data/lib/claide/ansi/graphics.rb +2 -2
- data/lib/claide/ansi/string_escaper.rb +1 -1
- data/lib/claide/command.rb +10 -12
- data/lib/claide/command/banner.rb +1 -1
- data/lib/claide/command/shell_completion_helper/zsh_completion_generator.rb +2 -2
- data/lib/claide/command/validation_helper.rb +1 -1
- data/lib/claide/help.rb +1 -1
- data/lib/claide/informative_error.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: c401c5a5be0c7e2652c31c9cc82a46dca6a8b4b2
|
4
|
+
data.tar.gz: 76dc8118415015daf186720e9c188f86bd37c512
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b38f9c3ef3e9a08dc2b6f52002aa928e48216f3b1fe3997d1613499c1f1716566e6f865a498c4f2e3854aaf4db9e2308a5b02549d884fd115ec5477da7a1077
|
7
|
+
data.tar.gz: 636d2249e8aacb1a0cfe05f88131c7aa46b4fb9904c45075ad51647c5f801442ac7ed312b0b58eefc8997089dd233f130ea125956d32c4af088197d420d65ae5
|
data/lib/claide.rb
CHANGED
data/lib/claide/ansi/graphics.rb
CHANGED
@@ -39,7 +39,7 @@ module CLAide
|
|
39
39
|
# @return [String] The escape sequence for a foreground color using the
|
40
40
|
# xterm-256 format.
|
41
41
|
#
|
42
|
-
# @param [Fixnum]
|
42
|
+
# @param [Fixnum] color
|
43
43
|
# The value of the color.
|
44
44
|
#
|
45
45
|
def self.foreground_color_256(color)
|
@@ -50,7 +50,7 @@ module CLAide
|
|
50
50
|
# @return [String] The escape sequence for a background color using the
|
51
51
|
# xterm-256 format.
|
52
52
|
#
|
53
|
-
# @param [Fixnum]
|
53
|
+
# @param [Fixnum] color
|
54
54
|
# The value of the color.
|
55
55
|
#
|
56
56
|
def self.background_color_256(color)
|
data/lib/claide/command.rb
CHANGED
@@ -89,27 +89,28 @@ module CLAide
|
|
89
89
|
#
|
90
90
|
attr_accessor :plugin_prefix
|
91
91
|
|
92
|
-
# @return [Array<
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
92
|
+
# @return [Array<Array<String,Symbol>>]
|
93
|
+
# A list of arguments the command handles. This is shown
|
94
|
+
# in the usage section of the command’s help banner.
|
95
|
+
# Each Array<String,Symbol> tuple in the array represents an
|
96
|
+
# argument using the form [name, type] where:
|
96
97
|
# - name is a String containing the argument
|
97
98
|
# - type is either :optional or :required
|
98
99
|
#
|
99
|
-
# @
|
100
|
+
# @todo Remove deprecation
|
100
101
|
#
|
101
|
-
# rubocop:disable all
|
102
102
|
attr_accessor :arguments
|
103
103
|
def arguments
|
104
104
|
@arguments ||= []
|
105
105
|
end
|
106
106
|
|
107
|
-
# @param [Array<
|
107
|
+
# @param [Array<Array<String,Symbol>>] arguments
|
108
108
|
# An array containing arguments, each described by a tuple of
|
109
109
|
# the form [name, type], where:
|
110
110
|
# - name is a String containing the argument
|
111
111
|
# - type is either :optional or :required
|
112
112
|
#
|
113
|
+
# rubocop:disable MethodLength
|
113
114
|
def arguments=(arguments)
|
114
115
|
if arguments.is_a?(Array)
|
115
116
|
@arguments = arguments
|
@@ -125,7 +126,7 @@ module CLAide
|
|
125
126
|
end
|
126
127
|
end
|
127
128
|
end
|
128
|
-
# rubocop:enable
|
129
|
+
# rubocop:enable MethodLength
|
129
130
|
|
130
131
|
# @return [Boolean] The default value for {Command#ansi_output}. This
|
131
132
|
# defaults to `true` if `STDOUT` is connected to a TTY and
|
@@ -274,8 +275,8 @@ module CLAide
|
|
274
275
|
PluginsHelper.load_plugins(plugin_prefix)
|
275
276
|
command = parse(argv)
|
276
277
|
|
278
|
+
ANSI.disabled = !command.ansi_output?
|
277
279
|
unless Options.handle_root_option(command, argv)
|
278
|
-
ANSI.disabled = !ansi_output?
|
279
280
|
command.validate!
|
280
281
|
command.run
|
281
282
|
end
|
@@ -351,9 +352,6 @@ module CLAide
|
|
351
352
|
#
|
352
353
|
# Returns the banner for the command.
|
353
354
|
#
|
354
|
-
# @param [Boolean] ansi
|
355
|
-
# Whether the banner should use ANSI codes to prettify output.
|
356
|
-
#
|
357
355
|
# @param [Class] banner_class
|
358
356
|
# The class to use to format help banners.
|
359
357
|
#
|
@@ -27,7 +27,7 @@ module CLAide
|
|
27
27
|
['Options', formatted_options_description]
|
28
28
|
]
|
29
29
|
banner = sections.map do |(title, body)|
|
30
|
-
["#{
|
30
|
+
[prettify_title("#{title}:"), body] unless body.empty?
|
31
31
|
end.compact.join("\n\n")
|
32
32
|
banner
|
33
33
|
end
|
@@ -32,7 +32,7 @@ module CLAide
|
|
32
32
|
# @param [Class] command
|
33
33
|
# The command to generate the fragment for.
|
34
34
|
#
|
35
|
-
# @param [Fixnum]
|
35
|
+
# @param [Fixnum] nest_level
|
36
36
|
# The nesting level to detect the index of the words array.
|
37
37
|
#
|
38
38
|
# @return [String] the case statement fragment.
|
@@ -82,7 +82,7 @@ module CLAide
|
|
82
82
|
# @param [Class] command
|
83
83
|
# The command to generate the fragment for.
|
84
84
|
#
|
85
|
-
# @param [Fixnum]
|
85
|
+
# @param [Fixnum] nest_level
|
86
86
|
# The nesting level to detect the index of the words array.
|
87
87
|
#
|
88
88
|
# @return [String] the case statement fragment.
|
data/lib/claide/help.rb
CHANGED
@@ -5,7 +5,7 @@ module CLAide
|
|
5
5
|
# while running {Command.run}, only the message of the exception will be
|
6
6
|
# shown to the user. Unless disabled with the `--verbose` flag.
|
7
7
|
#
|
8
|
-
# In addition, the message will be colored red, if {Command.
|
8
|
+
# In addition, the message will be colored red, if {Command.ansi_output}
|
9
9
|
# is set to `true`.
|
10
10
|
#
|
11
11
|
module InformativeError
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: claide
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-05-
|
12
|
+
date: 2014-05-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description:
|
15
15
|
email:
|