Sha256: 28357db5f50ab9988b1fe633050fe9d6c94c16943e21ae0a36976ae827bafa55
Contents?: true
Size: 1.16 KB
Versions: 68
Compression:
Stored size: 1.16 KB
Contents
#!/usr/bin/env ruby $:.unshift(File.dirname(__FILE__)+"/../lib") require 'format/bake_format' begin if ARGV.size == 2 indent = ' ' input = ARGV[0] output = ARGV[1] elsif ARGV.size == 3 indent = ARGV[0] indent = indent.split('=') raise 'indent must have =' unless indent.size == 2 raise 'indent must start with --indent' unless indent.first == '--indent' indent = indent.last input = ARGV[1] output = ARGV[2] else raise 'cannot understand' end rescue puts [ "Usage: #{__FILE__} [--indent=string] input output", " --indent=string, indent defaults to two spaces.", " Note, you can escape a tab in bash by ctrl-vTAB with sourrounding \" e.g. \"--input= \"", " input, filename or '-' for stdin", " output, filename, '-' for stdout, '--' for same as input file" ].join("\n") exit 1 end data = if input == '-' STDIN.read else File.read(input) end out = if output == '-' STDOUT elsif output == '--' out = input == STDIN ? STDOUT : File.open(input, 'w') else File.open(output, 'w') end bake_format(data, out, indent)
Version data entries
68 entries across 68 versions & 1 rubygems