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

Version Path
ix-cli-0.0.27 bin/ix-truncate
ix-cli-0.0.26 bin/ix-truncate
ix-cli-0.0.25 bin/ix-truncate
ix-cli-0.0.24 bin/ix-truncate
ix-cli-0.0.23 bin/ix-truncate
ix-cli-0.0.22 bin/ix-truncate
ix-cli-0.0.21 bin/ix-truncate
ix-cli-0.0.20 bin/ix-truncate
ix-cli-0.0.19 bin/ix-truncate
ix-cli-0.0.18 bin/ix-truncate
ix-cli-0.0.17 bin/ix-truncate
ix-cli-0.0.16 bin/ix-truncate
ix-cli-0.0.15 bin/ix-truncate
ix-cli-0.0.14 bin/ix-truncate
ix-cli-0.0.13 bin/ix-truncate
ix-cli-0.0.12 bin/ix-truncate
ix-cli-0.0.11 bin/ix-truncate
ix-cli-0.0.10 bin/ix-truncate
ix-cli-0.0.9 bin/ix-truncate
ix-cli-0.0.7 bin/ix-truncate