Sha256: 65c74a63a9500041654f80e07f73c3f97a7912ca05f46ab643e50a6747c45a51
Contents?: true
Size: 497 Bytes
Versions: 10
Compression:
Stored size: 497 Bytes
Contents
#!/usr/bin/env ruby require 'optparse' options = {} options[:width] = 40 OptionParser.new do |opts| opts.banner = "Usage: #{$0} [OPTIONS]" opts.on('-w', '--width [NUMBER]', 'Width.') do |value| options[:width] = value.to_i end end.parse! required_options = [:width] required_options.each do |option| unless options[option] $stderr.puts "Can not run #{option.to_s} was not given." exit 1 end end STDIN.each_line do |line| puts line.chomp.center(options[:width]) end
Version data entries
10 entries across 10 versions & 1 rubygems