Sha256: de669ffe6ab494759a2e729f10c9de44bb09b2ab5a984e7409ccee5191902912

Contents?: true

Size: 882 Bytes

Versions: 13

Compression:

Stored size: 882 Bytes

Contents

require 'haveapi/go_client'
require 'optparse'

module HaveAPI::GoClient
  class Cli
    def self.run
      options = {
        package: 'client',
      }

      parser = OptionParser.new do |opts|
        opts.banner = "Usage: #{$0} [options] <api url> <destination>"

        opts.on('--version VERSION', 'Use specified API version') do |v|
          options[:version] = v
        end

        opts.on('--module MODULE', 'Name of the generated Go module') do |v|
          options[:module] = v
        end

        opts.on('--package PKG', 'Name of the generated Go package') do |v|
          options[:package] = v
        end
      end

      parser.parse!

      if ARGV.length != 2
        warn 'Invalid arguments'
        puts @global_opt.help
        exit(false)
      end

      g = Generator.new(ARGV[0], ARGV[1], options)
      g.generate
      g.go_fmt
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
haveapi-go-client-0.20.0 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.19.3 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.19.2 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.19.1 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.19.0 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.18.2 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.18.1 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.18.0 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.17.0 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.16.3 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.16.2 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.16.1 lib/haveapi/go_client/cli.rb
haveapi-go-client-0.16.0 lib/haveapi/go_client/cli.rb