Sha256: bea0623955a66a0cd0f466768bd152569c73deb6b69a288e844c36b5d2a0d0cd

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

require 'thor'

module Sumcli
  module Commands
    class Add < Thor

      namespace :add

      desc 'migration NAME', 'Create migration'
      method_option :help, aliases: '-h', type: :boolean,
                           desc: 'Display usage information'
      def migration(name)
        if options[:help]
          invoke :help, ['migration']
        else
          require_relative 'add/migration'
          Sumcli::Commands::Add::Migration.new(name, options).execute
        end
      end

      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.6.0 lib/sumcli/commands/add.rb