Sha256: 4880f555ad5a2ba94a426822016c2d8ddc3217abfa4315c8941826631cffb3aa

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require 'optparse'

require 'solidus_dev_support/version'

Options = Struct.new(:name)

class Parser
  class << self
    def parse(args)
      options.parse!(args)
    end

    def options
      OptionParser.new do |opts|
        opts.banner = 'Usage: solidus [[extension extension_name] | [-h] [-v]]'

        opts.on('-h', '--help', 'Prints this help') do
          puts opts
        end

        opts.on(
          '-v',
          '--version',
          "Prints the current version: #{SolidusDevSupport::VERSION}"
        ) do
          puts SolidusDevSupport::VERSION
        end
      end
    end
  end
end

# Print help if no options are supplied
ARGV << '--help' unless ARGV.first

if ARGV.first == 'extension' || ARGV.first == 'e'
  ARGV.shift

  unless ARGV.first
    puts 'An extension must have a name!'
    puts `solidus -h`
    exit 1
  end

  require 'solidus_dev_support'
  require 'solidus_dev_support/extension'
  SolidusDevSupport::Extension.start
else
  Parser.parse(ARGV)
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_dev_support-0.3.0 exe/solidus