# general-commands.rb: various global scope commands # copyright (c) 2009 by Vincent Fourmond # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details (in the COPYING file). require 'ctioga2/utils' require 'ctioga2/commands/general-types' require 'ctioga2/commands/parsers/file' module CTioga2 Version::register_svn_info('$Revision: 155 $', '$Date: 2010-06-21 21:41:32 +0200 (Mon, 21 Jun 2010) $') module Commands # General scope commands. GeneralGroup = CmdGroup.new('general', "General commands", "General scope commands", 1000) CommandLineHelpOptions = { 'pager' => CmdArg.new('boolean') } # Display help on the command-line CommandLineHelpCommand = Cmd.new("command-line-help", 'h', "--help", [ ], CommandLineHelpOptions) do |plotmaker, options| plotmaker.interpreter.doc.display_command_line_help(options) exit end CommandLineHelpCommand.describe("Prints help on command-line options and exits", < ctioga2 -f my_file.ct2 EOH # Evaluate a series of commands. EvalCommand = Cmd.new("eval", '-e', "--eval", [ CmdArg.new('commands'), ]) do |plotmaker, string| plotmaker.interpreter.run_commands(string) end EvalCommand.describe("Runs the given commands", <