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.15.0.beta1 lib/bridgetown-core/commands/base.rb