Sha256: 67c598d48e061229d4e0bf68fe16f3d87c4f664dea07d32d760e8a2b4c7402d2

Contents?: true

Size: 796 Bytes

Versions: 15

Compression:

Stored size: 796 Bytes

Contents

<% namespace do %>
  module CLI
    # The main Command Line Interface (CLI) object.
    class Shell
      include Actions::Import[:config, :specification, :logger]

      def initialize parser: Parser.new, **dependencies
        super(**dependencies)
        @parser = parser
      end

      def call arguments = []
        perform parser.call(arguments)
      rescue OptionParser::ParseError => error
        logger.error { error.message }
      end

      private

      attr_reader :parser

      def perform configuration
        case configuration
          in action_config: Symbol => action then config.call action
          in action_version: true then logger.info { specification.labeled_version }
          else logger.any { parser.to_s }
        end
      end
    end
  end
<% end %>

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gemsmith-19.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-19.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.9.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.8.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.7.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.6.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.5.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.4.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.3.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.2.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.1.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.1.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.0.2 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.0.1 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb
gemsmith-18.0.0 lib/gemsmith/templates/%project_name%/lib/%project_path%/cli/shell.rb.erb