Sha256: 4881c3e967a491d7c92873dd3a13c4480e224a18a70c7fd0cce4ebe3c7f9acf0

Contents?: true

Size: 729 Bytes

Versions: 40

Compression:

Stored size: 729 Bytes

Contents

# coding: utf-8
# frozen_string_literal: true

module Stealth
  module CliBase
    def define_commands(&blk)
      class_eval(&blk) if block_given?
    end

    def banner(command, nspace = true, subcommand = false)
      super(command, nspace, namespace != 'stealth:cli')
    end

    def handle_argument_error(command, error, args, arity)
      name = [(namespace == 'stealth:cli' ? nil : namespace), command.name].compact.join(" ")

      msg = "ERROR: \"#{basename} #{name}\" was called with "
      msg << "no arguments"               if     args.empty?
      msg << "arguments " << args.inspect unless args.empty?
      msg << "\nUsage: #{banner(command).inspect}"

      raise Thor::InvocationError, msg
    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
stealth-2.0.0.beta7 lib/stealth/cli_base.rb
stealth-2.0.0.beta6 lib/stealth/cli_base.rb
stealth-2.0.0.beta5 lib/stealth/cli_base.rb
stealth-2.0.0.beta4 lib/stealth/cli_base.rb
stealth-2.0.0.beta3 lib/stealth/cli_base.rb
stealth-2.0.0.beta2 lib/stealth/cli_base.rb
stealth-2.0.0.beta1 lib/stealth/cli_base.rb
stealth-1.1.6 lib/stealth/cli_base.rb
stealth-1.1.5 lib/stealth/cli_base.rb
stealth-1.1.4 lib/stealth/cli_base.rb
stealth-1.1.3 lib/stealth/cli_base.rb
stealth-1.1.2 lib/stealth/cli_base.rb
stealth-1.1.1 lib/stealth/cli_base.rb
stealth-1.1.0 lib/stealth/cli_base.rb
stealth-1.1.0.rc3 lib/stealth/cli_base.rb
stealth-1.1.0.rc2 lib/stealth/cli_base.rb
stealth-1.1.0.rc1 lib/stealth/cli_base.rb
stealth-1.0.4 lib/stealth/cli_base.rb
stealth-1.0.3 lib/stealth/cli_base.rb
stealth-1.0.2 lib/stealth/cli_base.rb