Class: ModuleSync::CLI::Thor
- Inherits:
-
Thor
- Object
- Thor
- ModuleSync::CLI::Thor
- Defined in:
- lib/modulesync/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`
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
31 32 33 |
# File 'lib/modulesync/cli/thor.rb', line 31 def self.exit_on_failure? true end |
.start(*args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/modulesync/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/modulesync/cli/thor.rb', line 25 def _invalid_command_call self.class.new.help exit 1 end |