Improve script input
This commit is contained in:
parent
032c7c6339
commit
2c7228c0e0
2 changed files with 12 additions and 7 deletions
12
test.rb
12
test.rb
|
@ -99,16 +99,20 @@ cmd :REGISTER_CATEGORY, :link
|
|||
###################
|
||||
|
||||
cmd :REGISTER_FORMAT, { name: :html,
|
||||
stdin: { notes: nil },
|
||||
args: ['test/render.rb',
|
||||
{ template: nil },
|
||||
{ format: nil }] }
|
||||
{ format: nil }],
|
||||
stdin: ['{"notes":',
|
||||
{ notes: nil },
|
||||
'}'] }
|
||||
|
||||
cmd :REGISTER_FORMAT, { name: :json,
|
||||
stdin: { notes: nil },
|
||||
args: ['test/render.rb',
|
||||
{ template: nil },
|
||||
{ format: nil }] }
|
||||
{ format: nil }],
|
||||
stdin: ['{"notes":',
|
||||
{ notes: nil },
|
||||
'}'] }
|
||||
|
||||
################
|
||||
# REGISTER_REF #
|
||||
|
|
|
@ -12,6 +12,7 @@ def template(filename)
|
|||
end.freeze
|
||||
end
|
||||
|
||||
puts template("#{ARGV[0]}.#{ARGV[1]}.erb").result_with_hash(
|
||||
notes: JSON.parse($stdin.read),
|
||||
).strip
|
||||
name = "#{ARGV[0]}.#{ARGV[1]}.erb".freeze
|
||||
vars = JSON.parse($stdin.read).freeze
|
||||
|
||||
puts template(name).result_with_hash(vars).strip
|
||||
|
|
Loading…
Add table
Reference in a new issue