Sha256: 6879b99742325d7a1607eeccb99256aa63facbd56068d6e30af73fcb59011fbe

Contents?: true

Size: 1.2 KB

Versions: 21

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true

require_all "bridgetown-core/commands/concerns"
require_all "bridgetown-core/commands"

module Bridgetown
  module Commands
    class Base < Thor
      def self.exit_on_failure?
        true
      end

      Registrations.registrations.each do |block|
        instance_exec(&block)
      end

      class << self
        # Override single character commands if necessary
        def find_command_possibilities(subcommand)
          if subcommand == "c"
            ["console"]
          else
            super
          end
        end
      end

      desc "help <command>", "Show detailed command usage information and exit"
      def help(subcommand = nil)
        if subcommand && respond_to?(subcommand)
          klass = Kernel.const_get("Bridgetown::Commands::#{subcommand.capitalize}")
          klass.start(["-h"])
        else
          puts "Bridgetown v#{Bridgetown::VERSION.magenta} \"#{Bridgetown::CODE_NAME.yellow}\"" \
               " is a Webpack-aware, Ruby-powered static site generator for the modern Jamstack era"
          puts ""
          puts "Usage:"
          puts "  bridgetown <command> [options]"
          puts ""
          super
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
bridgetown-core-0.19.3 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.19.2 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.19.1 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.19.0 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.6 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.5 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.4 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.3 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.2 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.1 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.18.0 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.17.1 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.17.0 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.16.0 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.16.0.beta2 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.16.0.beta1 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.15.0 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.15.0.beta4 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.15.0.beta3 lib/bridgetown-core/commands/base.rb
bridgetown-core-0.15.0.beta2 lib/bridgetown-core/commands/base.rb