Sha256: 83b7298cd27fd7ad7bf2e6c6f7b412a3dc0ba8eb042e3da879f87c02634f17fc

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

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

require 'optparse'
require 'restartable'

options = {}
option_parser = OptionParser.new do |op|
  op.banner = <<-TEXT
#{op.program_name} v#{Restartable.version}

Usege:
  #{op.program_name} [options] command [arg…]

  TEXT

  op.on_tail('-h', '--help', 'Show full help') do
    puts option_parser.help
    exit
  end

  op.on_tail('--version', 'Show version') do
    puts Restartable.version
    exit
  end
end

begin
  option_parser.order!
  raise OptionParser::ParseError, 'No command to run' if ARGV.empty?
rescue OptionParser::ParseError => e
  abort "#{e.to_s}\n\n#{option_parser.help}"
end

Restartable.new(options) do
  exec *ARGV
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
restartable-0.2.2 bin/restartable
restartable-0.2.1 bin/restartable
restartable-0.2.0 bin/restartable