Class: Resedit::ScriptCommand
- Inherits:
-
AppCommand
- Object
- AppCommand
- Resedit::ScriptCommand
- Defined in:
- lib/resedit/app/std_commands.rb
Instance Attribute Summary
Attributes inherited from AppCommand
#names, #ohash, #opts, #params, #type
Instance Method Summary collapse
-
#initialize ⇒ ScriptCommand
constructor
A new instance of ScriptCommand.
- #job(params) ⇒ Object
Methods inherited from AppCommand
#addOption, #addParam, #log, #logd, #loge, #parseParams, #run
Constructor Details
#initialize ⇒ ScriptCommand
Returns a new instance of ScriptCommand.
74 75 76 77 |
# File 'lib/resedit/app/std_commands.rb', line 74 def initialize super(['script', '--script', '-s']) addParam('file', 'script file') end |
Instance Method Details
#job(params) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/resedit/app/std_commands.rb', line 78 def job(params) App::get().logd("running script %s", params['file']); script = [] text=File.open(params['file']).read text.gsub!(/\r\n?/, "\n") text.each_line {|line| script += [App.get().parseCommand(line.chomp())] } script.each{|cmd| cmd[0].run(cmd[1]) if cmd } end |