Sha256: 0d66b6d49ccb119c8f865a52434d1e4f0844a5e72c6abe30304d1ec196129901

Contents?: true

Size: 794 Bytes

Versions: 9

Compression:

Stored size: 794 Bytes

Contents

require 'pathname'
require 'optparse'

require 'bitclust/rrdparser'

module BitClust
  module Subcommands
    class PreprocCommand < Subcommand

      def initialize
        super
        @params = { "version" => "2.0.0" }
        @parser.banner = "Usage: #{File.basename($0, '.*')} <file>..."
        @parser.on('--param=KVPAIR', 'Set parameter by key/value pair.') {|pair|
          key, value = pair.split('=', 2)
          @params[key] = value
        }
      end

      def exec(argv, options)
        argv.each do |path|
          File.open(path) {|file|
            Preprocessor.wrap(file, @params).each do |line|
              puts line
            end
          }
        end
      rescue WriterError => err
        $stderr.puts err.message
        exit 1
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bitclust-core-1.2.6 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.5 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.4 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.3 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.2 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.1 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.2.0 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.1.1 lib/bitclust/subcommands/preproc_command.rb
bitclust-core-1.1.0 lib/bitclust/subcommands/preproc_command.rb