console_runner 0.1.26 → 0.1.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/command_line_parser.rb +5 -5
- data/lib/console_runner/version.rb +1 -1
- data/lib/console_runner_error.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 614357167cb89854843845188c98d84f602c205a
|
4
|
+
data.tar.gz: 1b91e965ac69852bcfcb36a9f68a05050abed0fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b444c1f0b4442c99cb0258bffafd85dc6343b5d6a95eb34dcdf1782f79607085b18c928f44d00107f7e933e04e208be3653184a6a48243d683e0b4a578e1a094
|
7
|
+
data.tar.gz: fdb0675ae820cfce774d83be778e41dbbcb4a747ed1a2568ee96c1b43565eba77f562d4b657e514a50c49e89480b8096bf0a978172d70a1d9eb6d86c391f932e
|
data/lib/command_line_parser.rb
CHANGED
@@ -10,15 +10,16 @@ class CommandLineParser
|
|
10
10
|
# Generate tool help menu.
|
11
11
|
# IMPORTANT! Should be executed before ARGV.shift
|
12
12
|
def initialize(file_parser)
|
13
|
-
@file_parser
|
14
|
-
@sub_commands
|
15
|
-
@sub_commands_text
|
13
|
+
@file_parser = file_parser
|
14
|
+
@sub_commands = @file_parser.runnable_methods.map { |m| m.name.to_s }
|
15
|
+
@sub_commands_text = @file_parser.runnable_methods.map do |m|
|
16
16
|
[
|
17
17
|
m.name.to_s,
|
18
18
|
FileParser.select_runnable_tags(m).map(&:text).join("\n")
|
19
19
|
]
|
20
20
|
end.to_h
|
21
|
-
@parser
|
21
|
+
@parser = Trollop::Parser.new
|
22
|
+
CommandLineParser.debug = ARGV.any? { |a| %w(-d --debug).include? a }
|
22
23
|
@parser.opt(:debug, 'Run in debug mode.', type: :flag)
|
23
24
|
@parser.stop_on @sub_commands
|
24
25
|
@initialize_method = nil
|
@@ -52,7 +53,6 @@ class CommandLineParser
|
|
52
53
|
action_index = ARGV.index(action)
|
53
54
|
scope = ARGV[0..action_index] if action_index
|
54
55
|
end
|
55
|
-
CommandLineParser.debug = ARGV.any? { |a| %w(-d --debug).include? a }
|
56
56
|
return unless scope.any? { |a| %w(-h --help).include? a }
|
57
57
|
@parser.banner("\n" + banner)
|
58
58
|
Trollop::with_standard_exception_handling(@parser) { raise Trollop::HelpNeeded }
|
data/lib/console_runner_error.rb
CHANGED