Sha256: 52d79cdd7b2b28a3c3ef6cdfd4adc6d74a916410b8612e818621978ba0f02bfe
Contents?: true
Size: 530 Bytes
Versions: 11
Compression:
Stored size: 530 Bytes
Contents
command "run" do |c| c.syntax = "datapimp run FILE" c.description = "runs a script in the context of the datapimp config" c.option '--format FORMAT', String, 'which format should we serialize the result? json default' c.action do |args, options| code = "" args.each do |arg| code += Pathname(arg).read end result = begin eval(code) rescue {error: $!} end if options.format == "json" puts JSON.generate(result) if result else puts result end end end
Version data entries
11 entries across 11 versions & 1 rubygems