command_kit 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d04119403fa9585e0258d2b20bb7c307d124aafb70c88e03749395c7b4eedb97
4
- data.tar.gz: 3ec992adf12bbc98313bb6ff8f3038091b50b31abbf8950765a71edd771378fb
3
+ metadata.gz: 306f055fa898d4d82c14ba8e79b397ae413280bb7144ce69e1787081620827e9
4
+ data.tar.gz: e79e640f7d4ae566401e7543d3ba98aa42b1e2396657734e29ab3cd3b383b41c
5
5
  SHA512:
6
- metadata.gz: faeeaa08921ab315a825d4b1ff69f6b254c53b6675dd4278478b77200d6d2afb688d110757685ed33d74b90a6b1e9394c12135c3ab5f08e2ca3ca5834ead248d
7
- data.tar.gz: 6b4ba3da0434c9fbd93d92a4c9d91e8eb53f1185df15edb21283c09b2ddf9ec4dc9fcb3708bdf83a1158cef92c988ccb5133ec5664ac9dcb213bdcde45aacf3d
6
+ metadata.gz: ee4268377db8c2398b5157feda9fa106a0b156537c6085b71fcfd8c7710f898c3bc0ef5d4408d9c6cbcae932e4f4ee4dd49070003e6c5734da06da33fbbace9a
7
+ data.tar.gz: 03b6a48369bea030002f9432d0d8645d8c0f5cdefba81778922e73a54f267611419bdb63e5033e98b09aa1c6ae97af1e8c3b8135cb7ed4b807fce666c6c379b8
@@ -12,6 +12,7 @@ jobs:
12
12
  ruby:
13
13
  - 2.7
14
14
  - 3.0
15
+ - 3.1
15
16
  # TODO: uncomment when jruby supports ruby >= 2.7
16
17
  # - jruby
17
18
  # TODO: uncomment when truffleruby supports splatting empty kwargs
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ AllCops:
7
7
  # our rules
8
8
  #
9
9
 
10
- Layout/FirstArrayElementIndentation: { EnforcedStyle: consistent }
10
+ Layout/FirstArrayElementIndentation: { Exclude: ['spec/**/*'] }
11
11
  Layout/LineLength: { Enabled: false }
12
12
  Layout/SpaceAroundEqualsInParameterDefault: { EnforcedStyle: no_space }
13
13
  Lint/ConstantDefinitionInBlock: { Exclude: ['spec/**/*'] }
data/ChangeLog.md CHANGED
@@ -1,3 +1,67 @@
1
+ ### 0.3.0 / 2021-12-26
2
+
3
+ * Added {CommandKit::FileUtils}.
4
+
5
+ #### CommandKit::FileUtils
6
+
7
+ * Added {CommandKit::FileUtils#erb #erb}.
8
+
9
+ #### CommandKit::Colors
10
+
11
+ * Added {CommandKit::Colors::ANSI::RESET_FG RESET_FG}.
12
+ * Added {CommandKit::Colors::ANSI.bright_black bright_black}.
13
+ * Added {CommandKit::Colors::ANSI.gray gray}.
14
+ * Added {CommandKit::Colors::ANSI.bright_red bright_red}.
15
+ * Added {CommandKit::Colors::ANSI.bright_green bright_green}.
16
+ * Added {CommandKit::Colors::ANSI.bright_yellow bright_yellow}.
17
+ * Added {CommandKit::Colors::ANSI.bright_blue bright_blue}.
18
+ * Added {CommandKit::Colors::ANSI.bright_magenta bright_magenta}.
19
+ * Added {CommandKit::Colors::ANSI.bright_cyan bright_cyan}.
20
+ * Added {CommandKit::Colors::ANSI.bright_white bright_white}.
21
+ * Added {CommandKit::Colors::ANSI.on_bright_black on_bright_black}.
22
+ * Added {CommandKit::Colors::ANSI.on_gray on_gray}.
23
+ * Added {CommandKit::Colors::ANSI.on_bright_red on_bright_red}.
24
+ * Added {CommandKit::Colors::ANSI.on_bright_green on_bright_green}.
25
+ * Added {CommandKit::Colors::ANSI.on_bright_yellow on_bright_yellow}.
26
+ * Added {CommandKit::Colors::ANSI.on_bright_blue on_bright_blue}.
27
+ * Added {CommandKit::Colors::ANSI.on_bright_magenta on_bright_magenta}.
28
+ * Added {CommandKit::Colors::ANSI.on_bright_cyan on_bright_cyan}.
29
+ * Added {CommandKit::Colors::ANSI.on_bright_white on_bright_white}.
30
+
31
+ #### ComandKit::Options
32
+
33
+ * Allow grouping options into categories:
34
+
35
+ option :opt1, category: 'Foo Options',
36
+ desc: 'Option 1'
37
+
38
+ option :opt2, category: 'Foo Options',
39
+ desc: 'Option 1'
40
+
41
+ * Allow options to have multi-line descriptions:
42
+
43
+ option :opt1, short: '-o',
44
+ desc: [
45
+ 'line1',
46
+ 'line2',
47
+ '...'
48
+ ]
49
+
50
+ #### CommandKit::Arguments
51
+
52
+ * Allow arguments to have multi-line descriptions:
53
+
54
+ argument :arg1, desc: [
55
+ 'line1',
56
+ 'line2',
57
+ '...'
58
+ ]
59
+
60
+
61
+ #### CommandKit::ProgramName
62
+
63
+ * Added {CommandKit::ProgramName#command_name}.
64
+
1
65
  ### 0.2.2 / 2021-12-26
2
66
 
3
67
  #### CommandKit::Help::Man
@@ -16,7 +16,7 @@ module CommandKit
16
16
 
17
17
  # The argument's description.
18
18
  #
19
- # @return [String]
19
+ # @return [String, Array<String>]
20
20
  attr_reader :desc
21
21
 
22
22
  #
@@ -34,7 +34,7 @@ module CommandKit
34
34
  # @param [Boolean] repeats
35
35
  # Specifies whether the argument can be repeated multiple times.
36
36
  #
37
- # @param [String] desc
37
+ # @param [String, Array<String>] desc
38
38
  # The description for the argument.
39
39
  #
40
40
  # @yield [(value)]
@@ -46,6 +46,14 @@ module CommandKit
46
46
  # def run(*files)
47
47
  # end
48
48
  #
49
+ # ### Multi-line descriptions
50
+ #
51
+ # argument :arg, desc: [
52
+ # 'line1',
53
+ # 'line2',
54
+ # '...'
55
+ # ]
56
+ #
49
57
  module Arguments
50
58
  include Usage
51
59
  include Main
@@ -114,7 +122,7 @@ module CommandKit
114
122
  # @option kwargs [Boolean] repeats
115
123
  # Specifies whether the argument can be repeated multiple times.
116
124
  #
117
- # @option kwargs [String] desc
125
+ # @option kwargs [String, Array<String>] desc
118
126
  # The description for the argument.
119
127
  #
120
128
  # @return [Argument]
@@ -123,6 +131,12 @@ module CommandKit
123
131
  # @example Define an argument:
124
132
  # argument :bar, desc: "Bar argument"
125
133
  #
134
+ # @example Defines an argument with a multi-line description:
135
+ # argument :bar, desc: [
136
+ # "Line 1 ...",
137
+ # "Line 2 ..."
138
+ # ]
139
+ #
126
140
  # @example With a custom usage string:
127
141
  # argument :bar, usage: 'BAR',
128
142
  # desc: "Bar argument"
@@ -191,7 +205,18 @@ module CommandKit
191
205
  puts 'Arguments:'
192
206
 
193
207
  arguments.each_value do |arg|
194
- puts " #{arg.usage.ljust(33)}#{arg.desc}"
208
+ case arg.desc
209
+ when Array
210
+ arg.desc.each_with_index do |line,index|
211
+ if index == 0
212
+ puts " #{arg.usage.ljust(33)}#{line}"
213
+ else
214
+ puts " #{' '.ljust(33)}#{line}"
215
+ end
216
+ end
217
+ else
218
+ puts " #{arg.usage.ljust(33)}#{arg.desc}"
219
+ end
195
220
  end
196
221
  end
197
222
  end