routeros-add-script/text-file-to-json.rb

14 lines
255 B
Ruby
Raw Normal View History

2024-03-31 23:33:33 +03:00
#!/usr/bin/env ruby
require "json"
object = { "name" => "default", "source" => "" }
script_name = ARGV[0]
filename = ARGV[1]
object["name"] = script_name
object["source"] = File.open(filename).readlines.join("\r\n")
puts JSON.pretty_generate(object)