bin/ratch in ratch-0.4.0 vs bin/ratch in ratch-0.4.1

- old
+ new

@@ -1,22 +1,37 @@ #! /usr/bin/env ruby +# TODO Create a more robust parser. + if ARGV[0] == '-s' require 'ratch/manager' manager = Ratch::Manager.new - file = ARGV[1] - if file - # run tool - if tool = manager.tool?(file) - require 'ratch/dsl' - load(tool) + + set = ARGV[1] + path = ARGV[2] + + if set + if setdirectory = manager.toolset?(set) + if path + if batchfile = manager.tool?(set, path) + require 'ratch/dsl' + self.batch_directory = setdirectory + load($0 = batchfile) + else + puts "no #{set} tool -- #{path}" + end + else + puts manager.tools(set).join("\n") + end else - puts "no tool -- #{file}" + puts "no toolset -- #{set}" end else - puts manager.toolset.join("\n") + puts manager.toolsets.join("\n") end + elsif ARGV.empty? + # TODO read stdin for ratch script else require 'ratch/dsl' load($0 = ARGV.shift)