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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cc7d7f59268bec92fc656c3999c983c819b16b74
4
- data.tar.gz: c1b9b2bce23334941e832dee7aa7f19a7ebb85c0
3
+ metadata.gz: c401c5a5be0c7e2652c31c9cc82a46dca6a8b4b2
4
+ data.tar.gz: 76dc8118415015daf186720e9c188f86bd37c512
5
5
  SHA512:
6
- metadata.gz: 171f3513817794fea26279c20f65a9d8cf71ab03edce821e428b86e363ebb75f69de418097c8a67a3415cd755b26f867e7c0b626944cc9c7a590e07a69b944ce
7
- data.tar.gz: 1949a384b568d4fa1722696827dc66059b3641dc932bdff88ec57721ca48434c15ad7920efbbd632eb8df74f09b1d7373a72b95fce5570aff52f20c0910def64
6
+ metadata.gz: 0b38f9c3ef3e9a08dc2b6f52002aa928e48216f3b1fe3997d1613499c1f1716566e6f865a498c4f2e3854aaf4db9e2308a5b02549d884fd115ec5477da7a1077
7
+ data.tar.gz: 636d2249e8aacb1a0cfe05f88131c7aa46b4fb9904c45075ad51647c5f801442ac7ed312b0b58eefc8997089dd233f130ea125956d32c4af088197d420d65ae5
data/lib/claide.rb CHANGED
@@ -8,7 +8,7 @@ module CLAide
8
8
  #
9
9
  # CLAide’s version, following [semver](http://semver.org).
10
10
  #
11
- VERSION = '0.6.0'
11
+ VERSION = '0.6.1'
12
12
 
13
13
  require 'claide/ansi'
14
14
  require 'claide/argv'
@@ -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] key
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] key
53
+ # @param [Fixnum] color
54
54
  # The value of the color.
55
55
  #
56
56
  def self.background_color_256(color)
@@ -6,7 +6,7 @@ module CLAide
6
6
  # `ANSI.disabled` setting.
7
7
  #
8
8
  class StringEscaper < String
9
- # @param [String] The string to wrap.
9
+ # @param [String] string The string to wrap.
10
10
  #
11
11
  def initialize(string)
12
12
  super
@@ -89,27 +89,28 @@ module CLAide
89
89
  #
90
90
  attr_accessor :plugin_prefix
91
91
 
92
- # @return [Array<Tuple>] A list of arguments the command handles. This
93
- # is shown in the usage section of the command’s help banner.
94
- # Each tuple in the array represents an argument using
95
- # [name, type] where:
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
- # @TODO Remove deprecation
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<Tuple>] arguments
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 all
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
- ["#{prettify_title(title)}:", body] unless body.empty?
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] nesting_level
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] nesting_level
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.
@@ -63,7 +63,7 @@ module CLAide
63
63
  # @param [String] suggestion
64
64
  # The suggestion to prettify.
65
65
  #
66
- # @param [Type]
66
+ # @param [Type] type
67
67
  # The type of the suggestion: either `:command` or `:option`.
68
68
  #
69
69
  # @return [String] A handsome suggestion.
data/lib/claide/help.rb CHANGED
@@ -33,7 +33,7 @@ module CLAide
33
33
  end
34
34
 
35
35
  # @return [String] The optional error message, colored in red if
36
- # {Command.colorize_output} is set to `true`.
36
+ # {Command.ansi_output} is set to `true`.
37
37
  #
38
38
  def formatted_error_message
39
39
  if error_message
@@ -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.colorize_output}
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.0
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-19 00:00:00.000000000 Z
12
+ date: 2014-05-20 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: