Sha256: 8d2edcc1c1967de594da9f77207f7f4b052fc3c81e94074b93726f37b406b62f

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

require 'optparse'
require_relative '../lib/opensource'

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: #{File.basename($PROGRAM_NAME)} OPTIONS"
  opts.separator ''
  opts.separator 'Specific options:'

  opts.on('-s', '--setup', 'Setup user credentials in ~/.osrc file') do |s|
    Opensource::Owner.set_credentials
    exit
  end

  opts.on('-l', '--license LICENSE', Opensource::LICENSES, "LICENSE can be #{Opensource::LICENSES.join('|')}") do |l|
    options[:license] = l
  end

  opts.on('-a', '--append README', 'Append LICENSE content to README file') do |a|
    options[:append] = a
  end

  opts.separator ''
  opts.separator 'Common options:'

  opts.on_tail('-v', '--version', 'Print the version') do
    puts Opensource::VERSION
    exit
  end

  opts.on_tail('-h', '--help', 'Show this message') do
    puts opts
    exit
  end
end.parse!

begin
  Opensource::License.new(options).process
rescue Opensource::Error => e
  # TODO: Make sure the above call raises only Opensource::Error
  puts "Error: #{e.message}"
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opensource-0.6.0 bin/opensource
opensource-0.4.0 bin/opensource