Sha256: ecacd9b638d0e184509fc71289578e1e87b8b24f5e358993944c627217b82a29

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

require 'thor'

module Sumcli
  module Commands
    class Add < Thor

      namespace :add

      desc 'service NAME', 'Installs infrastructure components and their initializers'
      method_option :help, aliases: '-h', type: :boolean,
                           desc: 'Display usage information'
      def service(name, version = nil)
        if options[:help]
          invoke :help, ['service']
        else
          require_relative 'add/service'
          Sumcli::Commands::Add::Service.new(name, version, options).execute
        end
      end

      desc 'endpoint NAME [METHOD] [ROUTE]', 'Generate a new endpoint using METHOD verb and matching url ROUTE'
      method_option :help, aliases: '-h', type: :boolean,
                           desc: 'Display usage information'
      def endpoint(name, method = nil, route = nil)
        if options[:help]
          invoke :help, ['endpoint']
        else
          require_relative 'add/endpoint'
          Sumcli::Commands::Add::Endpoint.new(name, method, route, options).execute
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sumcli-0.4.0 lib/sumcli/commands/add.rb