Class: Kojo::Commands::FileCmd
- Inherits:
-
MisterBin::Command
- Object
- MisterBin::Command
- Kojo::Commands::FileCmd
- Includes:
- Colsole
- Defined in:
- lib/kojo/commands/file.rb
Instance Method Summary collapse
Instance Method Details
#run(args) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/kojo/commands/file.rb', line 23 def run(args) opts = args['ARGS'].args_to_hash outfile = args['--save'] infile = args['INFILE'] argfile = args['--args'] if argfile fileopts = YAML.load_file(argfile).symbolize_keys opts = fileopts.merge opts end output = Kojo::Template.new(infile, opts).render if outfile File.write outfile, output say "Saved #{outfile}" else puts output end end |