Sha256: c9e886ea1020d3c6a608b84ab669b2accfe987564cef929ce992c080b7c7e2a2

Contents?: true

Size: 663 Bytes

Versions: 4

Compression:

Stored size: 663 Bytes

Contents

require 'thor'
require 'modulesync/cli'

module ModuleSync
  module CLI
    # 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
    class Thor < ::Thor
      desc '_invalid_command_call', 'Invalid command', hide: true
      def _invalid_command_call
        self.class.new.help
        exit 1
      end
      default_task :_invalid_command_call

      def self.exit_on_failure?
        true
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
modulesync-2.2.0 lib/modulesync/cli/thor.rb
modulesync-2.1.1 lib/modulesync/cli/thor.rb
modulesync-2.1.0 lib/modulesync/cli/thor.rb
modulesync-2.0.2 lib/modulesync/cli/thor.rb