Sha256: 47122a466caf18ca980fb1ca055d7b8d0efbbc63c7a77a6429ed20d4fa6e307f
Contents?: true
Size: 519 Bytes
Versions: 26
Compression:
Stored size: 519 Bytes
Contents
#!/usr/bin/env ruby require 'ostruct' require 'optparse' configuration = OpenStruct.new configuration.limit = 80 OptionParser.new do |options| options.banner = "USAGE: #{File.basename($0)} [OPTIONS]" help_string = 'Read from stdin and dump each truncated line to limit -l [N] to stdout.' parser = OptionParser::DecimalInteger options.on('-l', '--limit [N]', parser, help_string) do |value| configuration.limit = value end end.parse! STDIN.each_line do |line| puts line[0..configuration.limit] end
Version data entries
26 entries across 26 versions & 1 rubygems