command_kit 0.1.0.pre2 → 0.2.1

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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +15 -0
  3. data/.rubocop.yml +141 -0
  4. data/ChangeLog.md +98 -2
  5. data/Gemfile +3 -0
  6. data/README.md +189 -117
  7. data/Rakefile +3 -2
  8. data/command_kit.gemspec +4 -4
  9. data/examples/command.rb +1 -1
  10. data/gemspec.yml +10 -2
  11. data/lib/command_kit/arguments/argument.rb +2 -0
  12. data/lib/command_kit/arguments/argument_value.rb +2 -0
  13. data/lib/command_kit/arguments.rb +23 -4
  14. data/lib/command_kit/colors.rb +253 -45
  15. data/lib/command_kit/command.rb +6 -1
  16. data/lib/command_kit/command_name.rb +9 -0
  17. data/lib/command_kit/commands/auto_load.rb +24 -1
  18. data/lib/command_kit/commands/auto_require.rb +16 -0
  19. data/lib/command_kit/commands/command.rb +3 -0
  20. data/lib/command_kit/commands/help.rb +5 -2
  21. data/lib/command_kit/commands/parent_command.rb +7 -0
  22. data/lib/command_kit/commands/subcommand.rb +13 -1
  23. data/lib/command_kit/commands.rb +54 -9
  24. data/lib/command_kit/description.rb +12 -1
  25. data/lib/command_kit/env/home.rb +9 -0
  26. data/lib/command_kit/env/path.rb +16 -1
  27. data/lib/command_kit/env.rb +4 -0
  28. data/lib/command_kit/examples.rb +12 -1
  29. data/lib/command_kit/exception_handler.rb +4 -0
  30. data/lib/command_kit/help/man.rb +26 -30
  31. data/lib/command_kit/help.rb +7 -1
  32. data/lib/command_kit/inflector.rb +49 -17
  33. data/lib/command_kit/interactive.rb +248 -0
  34. data/lib/command_kit/main.rb +18 -9
  35. data/lib/command_kit/man.rb +44 -0
  36. data/lib/command_kit/open_app.rb +69 -0
  37. data/lib/command_kit/options/option.rb +3 -6
  38. data/lib/command_kit/options/option_value.rb +5 -2
  39. data/lib/command_kit/options/parser.rb +46 -19
  40. data/lib/command_kit/options/quiet.rb +3 -0
  41. data/lib/command_kit/options/verbose.rb +5 -0
  42. data/lib/command_kit/options/version.rb +6 -0
  43. data/lib/command_kit/options.rb +32 -7
  44. data/lib/command_kit/os/linux.rb +157 -0
  45. data/lib/command_kit/os.rb +165 -11
  46. data/lib/command_kit/package_manager.rb +200 -0
  47. data/lib/command_kit/pager.rb +80 -11
  48. data/lib/command_kit/printing/indent.rb +27 -4
  49. data/lib/command_kit/printing.rb +35 -1
  50. data/lib/command_kit/program_name.rb +7 -0
  51. data/lib/command_kit/stdio.rb +24 -0
  52. data/lib/command_kit/sudo.rb +40 -0
  53. data/lib/command_kit/terminal.rb +159 -0
  54. data/lib/command_kit/usage.rb +14 -0
  55. data/lib/command_kit/version.rb +1 -1
  56. data/lib/command_kit/xdg.rb +13 -0
  57. data/lib/command_kit.rb +1 -0
  58. data/spec/arguments/argument_spec.rb +2 -2
  59. data/spec/arguments_spec.rb +53 -27
  60. data/spec/colors_spec.rb +277 -13
  61. data/spec/command_name_spec.rb +1 -1
  62. data/spec/command_spec.rb +79 -5
  63. data/spec/commands/auto_load/subcommand_spec.rb +1 -1
  64. data/spec/commands/auto_load_spec.rb +34 -3
  65. data/spec/commands/auto_require_spec.rb +2 -2
  66. data/spec/commands/help_spec.rb +1 -1
  67. data/spec/commands/parent_command_spec.rb +1 -1
  68. data/spec/commands/subcommand_spec.rb +1 -1
  69. data/spec/commands_spec.rb +103 -29
  70. data/spec/description_spec.rb +1 -25
  71. data/spec/env/home_spec.rb +1 -1
  72. data/spec/env/path_spec.rb +7 -1
  73. data/spec/examples_spec.rb +1 -25
  74. data/spec/exception_handler_spec.rb +1 -1
  75. data/spec/help/man_spec.rb +45 -58
  76. data/spec/help_spec.rb +0 -25
  77. data/spec/inflector_spec.rb +71 -9
  78. data/spec/interactive_spec.rb +415 -0
  79. data/spec/main_spec.rb +7 -7
  80. data/spec/man_spec.rb +46 -0
  81. data/spec/open_app_spec.rb +85 -0
  82. data/spec/options/option_spec.rb +5 -5
  83. data/spec/options/option_value_spec.rb +56 -1
  84. data/spec/options_spec.rb +283 -1
  85. data/spec/os/linux_spec.rb +164 -0
  86. data/spec/os_spec.rb +201 -14
  87. data/spec/package_manager_spec.rb +806 -0
  88. data/spec/pager_spec.rb +76 -11
  89. data/spec/printing/indent_spec.rb +8 -6
  90. data/spec/printing_spec.rb +33 -3
  91. data/spec/program_name_spec.rb +1 -1
  92. data/spec/spec_helper.rb +0 -3
  93. data/spec/sudo_spec.rb +51 -0
  94. data/spec/{console_spec.rb → terminal_spec.rb} +65 -35
  95. data/spec/usage_spec.rb +2 -2
  96. data/spec/xdg_spec.rb +1 -1
  97. metadata +26 -8
  98. data/lib/command_kit/console.rb +0 -141
@@ -40,16 +40,22 @@ module CommandKit
40
40
  # The auto-load subcommands.
41
41
  #
42
42
  # @return [Hash{String => Subcommand}]
43
+ #
44
+ # @api private
43
45
  attr_reader :commands
44
46
 
45
47
  # The path to the directory containing the command files.
46
48
  #
47
49
  # @return [String]
50
+ #
51
+ # @api private
48
52
  attr_reader :dir
49
53
 
50
54
  # The namespace that the will contain the command classes.
51
55
  #
52
56
  # @return [String]
57
+ #
58
+ # @api private
53
59
  attr_reader :namespace
54
60
 
55
61
  #
@@ -65,6 +71,8 @@ module CommandKit
65
71
  # If a block is given, it will be used to explicitly map the files
66
72
  # within {#dir} as commands.
67
73
  #
74
+ # @api public
75
+ #
68
76
  def initialize(dir: , namespace: )
69
77
  @commands = {}
70
78
 
@@ -106,6 +114,8 @@ module CommandKit
106
114
  # @option kwargs [Array<String>] aliases
107
115
  # Optional alias names for the subcommand.
108
116
  #
117
+ # @api public
118
+ #
109
119
  def command(name, constant, file, **kwargs)
110
120
  @commands[name.to_s] = Subcommand.new(
111
121
  "#{@namespace}::#{constant}",
@@ -123,6 +133,8 @@ module CommandKit
123
133
  # @return [String]
124
134
  # The joined absolute path.
125
135
  #
136
+ # @api private
137
+ #
126
138
  def join(path)
127
139
  File.join(@dir,path)
128
140
  end
@@ -133,6 +145,8 @@ module CommandKit
133
145
  # @return [Array<String>]
134
146
  # The paths to the `.rb` files in the directory.
135
147
  #
148
+ # @api private
149
+ #
136
150
  def files
137
151
  Dir.glob(join('*.rb'))
138
152
  end
@@ -144,9 +158,18 @@ module CommandKit
144
158
  # @param [Class] command
145
159
  # The command class including {AutoLoad}.
146
160
  #
161
+ # @api private
162
+ #
147
163
  def included(command)
148
164
  command.include Commands
149
- command.commands.merge!(@commands)
165
+
166
+ @commands.each do |name,subcommand|
167
+ command.commands[name] = subcommand
168
+
169
+ subcommand.aliases.each do |alias_name|
170
+ command.command_aliases[alias_name] = name
171
+ end
172
+ end
150
173
  end
151
174
  end
152
175
  end
@@ -27,11 +27,15 @@ module CommandKit
27
27
  # The directory to attempt to require command files within.
28
28
  #
29
29
  # @return [String]
30
+ #
31
+ # @api private
30
32
  attr_reader :dir
31
33
 
32
34
  # The namespace to lookup command classes within.
33
35
  #
34
36
  # @return [String]
37
+ #
38
+ # @api private
35
39
  attr_reader :namespace
36
40
 
37
41
  #
@@ -43,6 +47,8 @@ module CommandKit
43
47
  # @param [String] namespace
44
48
  # The namespace to search for command classes in.
45
49
  #
50
+ # @api public
51
+ #
46
52
  def initialize(dir: , namespace: )
47
53
  @dir = dir
48
54
  @namespace = namespace
@@ -57,6 +63,8 @@ module CommandKit
57
63
  # @return [String]
58
64
  # The path to the file that should contain the command.
59
65
  #
66
+ # @api private
67
+ #
60
68
  def join(name)
61
69
  File.join(@dir,name)
62
70
  end
@@ -70,6 +78,8 @@ module CommandKit
70
78
  #
71
79
  # @raise [LoadError]
72
80
  #
81
+ # @api private
82
+ #
73
83
  def require(file_name)
74
84
  super(join(file_name))
75
85
  end
@@ -86,6 +96,8 @@ module CommandKit
86
96
  # @raise [NameError]
87
97
  # The command class could not be found within the {#namespace}.
88
98
  #
99
+ # @api private
100
+ #
89
101
  def const_get(constant)
90
102
  Object.const_get("::#{@namespace}::#{constant}",false)
91
103
  end
@@ -100,6 +112,8 @@ module CommandKit
100
112
  # The command's class, or `nil` if the command cannot be loaded from
101
113
  # {#dir} or found within {#namespace}.
102
114
  #
115
+ # @api private
116
+ #
103
117
  def command(command_name)
104
118
  file_name = Inflector.underscore(command_name)
105
119
 
@@ -125,6 +139,8 @@ module CommandKit
125
139
  # @param [Class] command
126
140
  # The command class including {AutoRequire}.
127
141
  #
142
+ # @api private
143
+ #
128
144
  def included(command)
129
145
  command.include Commands
130
146
  command.commands.default_proc = ->(hash,key) {
@@ -3,6 +3,9 @@ require 'command_kit/commands/parent_command'
3
3
 
4
4
  module CommandKit
5
5
  module Commands
6
+ #
7
+ # @api public
8
+ #
6
9
  class Command < CommandKit::Command
7
10
 
8
11
  include ParentCommand
@@ -8,11 +8,14 @@ module CommandKit
8
8
  #
9
9
  # The default help command.
10
10
  #
11
+ # @api semipublic
12
+ #
11
13
  class Help < Command
12
14
 
13
15
  include ParentCommand
14
16
 
15
- argument :command, desc: 'Command name to lookup'
17
+ argument :command, required: false,
18
+ desc: 'Command name to lookup'
16
19
 
17
20
  #
18
21
  # Prints the given commands `--help` output or lists registered commands.
@@ -32,7 +35,7 @@ module CommandKit
32
35
 
33
36
  subcommand.help
34
37
  else
35
- print_error "#{command_name}: unknown command: #{command}"
38
+ print_error "unknown command: #{command}"
36
39
  exit(1)
37
40
  end
38
41
  end
@@ -1,15 +1,22 @@
1
1
  module CommandKit
2
2
  module Commands
3
+ #
4
+ # Allows a command to be aware of it's parent command.
5
+ #
3
6
  module ParentCommand
4
7
 
5
8
  # The parent command instance.
6
9
  #
7
10
  # @return [Object<Commands>]
11
+ #
12
+ # @api semipublic
8
13
  attr_reader :parent_command
9
14
 
10
15
  #
11
16
  # Initializes the command and sets {#parent_command}.
12
17
  #
18
+ # @api public
19
+ #
13
20
  def initialize(parent_command: , **kwargs)
14
21
  @parent_command = parent_command
15
22
 
@@ -3,6 +3,8 @@ module CommandKit
3
3
  #
4
4
  # Represents a registered subcommand.
5
5
  #
6
+ # @api private
7
+ #
6
8
  class Subcommand
7
9
 
8
10
  # The command class.
@@ -34,12 +36,22 @@ module CommandKit
34
36
  # Optional alias names for the subcommand.
35
37
  #
36
38
  def initialize(command, summary: self.class.summary(command),
37
- aliases: [])
39
+ aliases: [])
38
40
  @command = command
39
41
  @summary = summary
40
42
  @aliases = aliases.map(&:to_s)
41
43
  end
42
44
 
45
+ #
46
+ # Derives a summary from the command's description.
47
+ #
48
+ # @param [Class] command
49
+ # The command class.
50
+ #
51
+ # @return [String, nil]
52
+ # If the command responds to a `#description` method, the first sentence
53
+ # of the description will be returned. Otherwise `nil` is returned.
54
+ #
43
55
  def self.summary(command)
44
56
  if command.respond_to?(:description)
45
57
  if (desc = command.description)
@@ -41,6 +41,9 @@ module CommandKit
41
41
  include Stdio
42
42
  include Env
43
43
 
44
+ #
45
+ # @api private
46
+ #
44
47
  module ModuleMethods
45
48
  #
46
49
  # Extends {ClassMethods} or {ModuleMethods}, depending on whether
@@ -56,6 +59,13 @@ module CommandKit
56
59
  context.extend ModuleMethods
57
60
  else
58
61
  context.usage "[options] [COMMAND [ARGS...]]"
62
+ context.argument :command, required: false,
63
+ desc: 'The command name to run'
64
+
65
+ context.argument :args, required: false,
66
+ repeats: true,
67
+ desc: 'Additional arguments for the command'
68
+
59
69
  context.extend ClassMethods
60
70
  context.command Help
61
71
  end
@@ -73,13 +83,15 @@ module CommandKit
73
83
  #
74
84
  # @return [Hash{String => Subcommand}]
75
85
  # The Hash of sub-command names and command classes.
86
+ #
87
+ # @api semipublic
76
88
  #
77
89
  def commands
78
90
  @commands ||= if superclass.kind_of?(ClassMethods)
79
- superclass.commands.dup
80
- else
81
- {}
82
- end
91
+ superclass.commands.dup
92
+ else
93
+ {}
94
+ end
83
95
  end
84
96
 
85
97
  #
@@ -88,6 +100,8 @@ module CommandKit
88
100
  # @return [Hash{String => String}]
89
101
  # The Hash of command aliases to primary command names.
90
102
  #
103
+ # @api semipublic
104
+ #
91
105
  def command_aliases
92
106
  @command_aliases ||= if superclass.kind_of?(ClassMethods)
93
107
  superclass.command_aliases.dup
@@ -125,17 +139,18 @@ module CommandKit
125
139
  # @example
126
140
  # command 'foo-bar', FooBar
127
141
  #
142
+ # @api public
143
+ #
128
144
  def command(name=nil, command_class, **kwargs)
129
145
  name = if name then name.to_s
130
146
  else command_class.command_name
131
147
  end
132
148
 
133
149
  subcommand = Subcommand.new(command_class,**kwargs)
134
-
135
150
  commands[name] = subcommand
136
151
 
137
- subcommand.aliases.each do |command_alias|
138
- command_aliases[command_alias] = name
152
+ subcommand.aliases.each do |alias_name|
153
+ command_aliases[alias_name] = name
139
154
  end
140
155
 
141
156
  return subcommand
@@ -145,8 +160,12 @@ module CommandKit
145
160
  # Gets the command.
146
161
  #
147
162
  # @param [String] name
163
+ # The command name.
148
164
  #
149
165
  # @return [Class#main, nil]
166
+ # The command class or `nil` if no command could be found.
167
+ #
168
+ # @api private
150
169
  #
151
170
  def get_command(name)
152
171
  name = name.to_s
@@ -164,6 +183,8 @@ module CommandKit
164
183
  # @note Adds a special rule to the {Options#option_parser #option_parser} to
165
184
  # stop parsing options when the first non-option is encountered.
166
185
  #
186
+ # @api public
187
+ #
167
188
  def initialize(**kwargs)
168
189
  super(**kwargs)
169
190
 
@@ -181,6 +202,8 @@ module CommandKit
181
202
  # @return [Object#main, nil]
182
203
  # The initialized subcommand.
183
204
  #
205
+ # @api private
206
+ #
184
207
  def command(name)
185
208
  unless (command_class = self.class.get_command(name))
186
209
  return
@@ -203,7 +226,9 @@ module CommandKit
203
226
  end
204
227
 
205
228
  if command_class.include?(Env)
206
- kwargs[:env] = env.dup
229
+ kwargs[:env] = if env.eql?(ENV) then env.to_h
230
+ else env.dup
231
+ end
207
232
  end
208
233
 
209
234
  if command_class.include?(Options)
@@ -225,6 +250,8 @@ module CommandKit
225
250
  # @return [Integer]
226
251
  # The exit status of the command.
227
252
  #
253
+ # @api semipublic
254
+ #
228
255
  def invoke(name,*argv)
229
256
  if (command = command(name))
230
257
  command.main(argv)
@@ -237,6 +264,9 @@ module CommandKit
237
264
  # Prints an error about an unknown command and exits with an error code.
238
265
  #
239
266
  # @param [String] name
267
+ # The command name.
268
+ #
269
+ # @api semipublic
240
270
  #
241
271
  def command_not_found(name)
242
272
  print_error "'#{name}' is not a #{command_name} command. See `#{command_name} help`"
@@ -256,6 +286,8 @@ module CommandKit
256
286
  #
257
287
  # @see command_not_found
258
288
  #
289
+ # @api semipublic
290
+ #
259
291
  def on_unknown_command(name,argv=[])
260
292
  command_not_found(name)
261
293
  end
@@ -265,24 +297,35 @@ module CommandKit
265
297
  #
266
298
  # @note If no subcommand is given, {#help} will be called.
267
299
  #
300
+ # @api public
301
+ #
268
302
  def run(command=nil,*argv)
269
303
  if command
270
304
  exit invoke(command,*argv)
271
305
  else
272
306
  help
307
+ exit(1)
273
308
  end
274
309
  end
275
310
 
276
311
  #
277
312
  # Prints the available commands and their summaries.
278
313
  #
314
+ # @api semipublic
315
+ #
279
316
  def help_commands
280
317
  unless self.class.commands.empty?
281
318
  puts
282
319
  puts "Commands:"
283
320
 
321
+ command_aliases = Hash.new { |hash,key| hash[key] = [] }
322
+
323
+ self.class.command_aliases.each do |alias_name,name|
324
+ command_aliases[name] << alias_name
325
+ end
326
+
284
327
  self.class.commands.sort.each do |name,subcommand|
285
- names = [name, *subcommand.aliases].join(', ')
328
+ names = [name, *command_aliases[name]].join(', ')
286
329
 
287
330
  if subcommand.summary
288
331
  puts " #{names}\t#{subcommand.summary}"
@@ -296,6 +339,8 @@ module CommandKit
296
339
  #
297
340
  # Prints help information and available commands.
298
341
  #
342
+ # @api public
343
+ #
299
344
  def help
300
345
  super
301
346
 
@@ -13,6 +13,9 @@ module CommandKit
13
13
  module Description
14
14
  include Help
15
15
 
16
+ #
17
+ # @api private
18
+ #
16
19
  module ModuleMethods
17
20
  #
18
21
  # Extends {ClassMethods} or {ModuleMethods}, depending on whether
@@ -50,6 +53,8 @@ module CommandKit
50
53
  # @example
51
54
  # description "Does things and stuff"
52
55
  #
56
+ # @api public
57
+ #
53
58
  def description(new_description=nil)
54
59
  if new_description
55
60
  @description = new_description
@@ -64,6 +69,8 @@ module CommandKit
64
69
  #
65
70
  # @see ClassMethods#description
66
71
  #
72
+ # @api semipublic
73
+ #
67
74
  def description
68
75
  self.class.description
69
76
  end
@@ -71,6 +78,8 @@ module CommandKit
71
78
  #
72
79
  # Prints the {ClassMethods#description description}, if set.
73
80
  #
81
+ # @api semipublic
82
+ #
74
83
  def help_description
75
84
  if (description = self.description)
76
85
  puts
@@ -82,8 +91,10 @@ module CommandKit
82
91
  # Calls the superclass'es `#help` method, if it's defined, then calls
83
92
  # {#help_description}.
84
93
  #
94
+ # @api public
95
+ #
85
96
  def help
86
- super if defined?(super)
97
+ super
87
98
 
88
99
  help_description
89
100
  end
@@ -14,6 +14,9 @@ module CommandKit
14
14
  module Home
15
15
  include Env
16
16
 
17
+ #
18
+ # @api private
19
+ #
17
20
  module ModuleMethods
18
21
  #
19
22
  # Extends {ClassMethods} or {ModuleMethods}, depending on whether
@@ -44,6 +47,8 @@ module CommandKit
44
47
  #
45
48
  # @return [String]
46
49
  #
50
+ # @api semipublic
51
+ #
47
52
  def home_dir
48
53
  Gem.user_home
49
54
  end
@@ -52,6 +57,8 @@ module CommandKit
52
57
  # The home directory.
53
58
  #
54
59
  # @return [String]
60
+ #
61
+ # @api public
55
62
  attr_reader :home_dir
56
63
 
57
64
  #
@@ -61,6 +68,8 @@ module CommandKit
61
68
  # @param [Hash{Symbol => Object}] kwargs
62
69
  # Additional keyword arguments.
63
70
  #
71
+ # @api public
72
+ #
64
73
  def initialize(**kwargs)
65
74
  super(**kwargs)
66
75
 
@@ -16,7 +16,9 @@ module CommandKit
16
16
 
17
17
  # The home directory.
18
18
  #
19
- # @return [String]
19
+ # @return [Array<String>]
20
+ #
21
+ # @api semipublic
20
22
  attr_reader :path_dirs
21
23
 
22
24
  #
@@ -25,6 +27,8 @@ module CommandKit
25
27
  # @param [Hash{Symbol => Object}] kwargs
26
28
  # Additional keyword arguments.
27
29
  #
30
+ # @api public
31
+ #
28
32
  def initialize(**kwargs)
29
33
  super(**kwargs)
30
34
 
@@ -41,6 +45,8 @@ module CommandKit
41
45
  # The absolute path to the executable file, or `nil` if the command
42
46
  # could not be found in any of the {#path_dirs}.
43
47
  #
48
+ # @api public
49
+ #
44
50
  def find_command(name)
45
51
  name = name.to_s
46
52
 
@@ -63,6 +69,15 @@ module CommandKit
63
69
  # Specifies whether a command with the given name exists in one of the
64
70
  # {#path_dirs}.
65
71
  #
72
+ # @example
73
+ # if command_installed?("docker")
74
+ # # ...
75
+ # else
76
+ # abort "Docker is not installed. Aborting"
77
+ # end
78
+ #
79
+ # @api public
80
+ #
66
81
  def command_installed?(name)
67
82
  !find_command(name).nil?
68
83
  end
@@ -23,6 +23,8 @@ module CommandKit
23
23
  # The environment variables hash.
24
24
  #
25
25
  # @return [Hash{String => String}]
26
+ #
27
+ # @api public
26
28
  attr_reader :env
27
29
 
28
30
  #
@@ -34,6 +36,8 @@ module CommandKit
34
36
  # @param [Hash{Symbol => Object}] kwargs
35
37
  # Additional keyword arguments.
36
38
  #
39
+ # @api public
40
+ #
37
41
  def initialize(env: ENV, **kwargs)
38
42
  @env = env
39
43
 
@@ -17,6 +17,9 @@ module CommandKit
17
17
  include Help
18
18
  include CommandName
19
19
 
20
+ #
21
+ # @api private
22
+ #
20
23
  module ModuleMethods
21
24
  #
22
25
  # Extends {ClassMethods} or {ModuleMethods}, depending on whether
@@ -57,6 +60,8 @@ module CommandKit
57
60
  # "-o output.txt path/to/file"
58
61
  # ]
59
62
  #
63
+ # @api public
64
+ #
60
65
  def examples(new_examples=nil)
61
66
  if new_examples
62
67
  @examples = Array(new_examples)
@@ -71,6 +76,8 @@ module CommandKit
71
76
  #
72
77
  # @see ClassMethods#examples
73
78
  #
79
+ # @api semipublic
80
+ #
74
81
  def examples
75
82
  self.class.examples
76
83
  end
@@ -78,6 +85,8 @@ module CommandKit
78
85
  #
79
86
  # Prints the command class'es example commands.
80
87
  #
88
+ # @api semipublic
89
+ #
81
90
  def help_examples
82
91
  if (examples = self.examples)
83
92
  puts
@@ -92,8 +101,10 @@ module CommandKit
92
101
  # Calls the superclass'es `#help` method, if it's defined, then calls
93
102
  # {#help_examples}.
94
103
  #
104
+ # @api public
105
+ #
95
106
  def help
96
- super if defined?(super)
107
+ super
97
108
 
98
109
  help_examples
99
110
  end
@@ -33,6 +33,8 @@ module CommandKit
33
33
  # @return [Integer]
34
34
  # The exit status of the command.
35
35
  #
36
+ # @api public
37
+ #
36
38
  def main(argv=[])
37
39
  super(argv)
38
40
  rescue Interrupt, Errno::EPIPE => error
@@ -47,6 +49,8 @@ module CommandKit
47
49
  # @param [Exception] error
48
50
  # The raised exception.
49
51
  #
52
+ # @api semipublic
53
+ #
50
54
  def on_exception(error)
51
55
  print_exception(error)
52
56
  exit(1)