Class: Choria::Colt::Thor
- Inherits:
-
Thor
- Object
- Thor
- Choria::Colt::Thor
- Defined in:
- lib/choria/colt/cli/thor.rb
Overview
Workaround some, still unfixed, Thor behaviors
This class extends ::Thor class to
-
exit with status code sets to ‘1` on Thor failure (e.g. missing required option)
-
exit with status code sets to ‘1` when user calls `msync` (or a subcommand) without required arguments
-
show subcommands help using ‘msync subcommand –help`
Direct Known Subclasses
Class Method Summary collapse
- .exit_on_failure? ⇒ Boolean
-
.is_thor_reserved_word?(word, type) ⇒ Boolean
rubocop:disable Naming/PredicateName.
- .start(*args) ⇒ Object
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
31 32 33 |
# File 'lib/choria/colt/cli/thor.rb', line 31 def self.exit_on_failure? true end |
.is_thor_reserved_word?(word, type) ⇒ Boolean
rubocop:disable Naming/PredicateName
35 36 37 38 39 |
# File 'lib/choria/colt/cli/thor.rb', line 35 def self.is_thor_reserved_word?(word, type) # rubocop:disable Naming/PredicateName return false if word == 'run' super end |
.start(*args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/choria/colt/cli/thor.rb', line 13 def self.start(*args) if (Thor::HELP_MAPPINGS & ARGV).any? && subcommands.none? { |command| command.start_with?(ARGV[0]) } Thor::HELP_MAPPINGS.each do |cmd| if (match = ARGV.delete(cmd)) ARGV.unshift match end end end super end |
Instance Method Details
#_invalid_command_call ⇒ Object
25 26 27 28 |
# File 'lib/choria/colt/cli/thor.rb', line 25 def _invalid_command_call self.class.new.help exit 1 end |