Module: CTioga2::Commands

Defined in:
lib/ctioga2/commands/interpreter.rb,
lib/ctioga2/commands/type.rb,
lib/ctioga2/commands/groups.rb,
lib/ctioga2/commands/doc/doc.rb,
lib/ctioga2/commands/doc/man.rb,
lib/ctioga2/commands/strings.rb,
lib/ctioga2/commands/commands.rb,
lib/ctioga2/commands/doc/help.rb,
lib/ctioga2/commands/doc/html.rb,
lib/ctioga2/commands/arguments.rb,
lib/ctioga2/commands/variables.rb,
lib/ctioga2/commands/doc/markup.rb,
lib/ctioga2/commands/doc/wordwrap.rb,
lib/ctioga2/commands/parsers/file.rb,
lib/ctioga2/commands/general-types.rb,
lib/ctioga2/commands/general-commands.rb,
lib/ctioga2/commands/doc/introspection.rb,
lib/ctioga2/commands/parsers/command-line.rb,
lib/ctioga2/commands/doc/documentation-commands.rb

Overview

This module contains the real core of ctioga2: a set of classes that implement the concept of commands. Each command translates into an action (of any kind).

Commands can be specified using several ways: either using command-line options/arguments or through a commands file.

Defined Under Namespace

Modules: Documentation, Parsers Classes: ArgumentNumberMismatch, Command, CommandArgument, CommandGroup, CommandOptionUnkown, CommandType, DoubleDefinition, Interpreter, InterpreterString, InvalidName, InvalidType, RecursiveExpansion, UnknownCommand, UnterminatedString, Variables

Constant Summary collapse

NameValidationRE =

A CommandGroup#id or Command#name should match this regular expression.

/^[a-z0-9-]+$/
FileType =

A file name.

CmdType.new('file', :string, <<EOD)
A file name.
EOD
TextType =

Plain text

CmdType.new('text', :string, <<EOD)
Plain text.
EOD
DatasetType =

A series of datasets

CmdType.new('dataset', :string, <<EOD)
One expandable dataset.
EOD
CommandsType =

Commands

CmdType.new('commands', :string, <<EOD)
ctioga2 commands, such as the ones that could be found in
command files.
EOD
BooleanType =
CmdType.new('boolean', :boolean, <<EOD)
Yes or no.
EOD
FloatType =
CmdType.new('float', :float, <<EOD)
A floating-point number.
EOD
IntegerType =
CmdType.new('integer', :integer, <<EOD)
An integer.
EOD
PartialFloatRangeType =
CmdType.new('partial-float-range', 
                                        :partial_float_range, <<EOD)
A beginning:end range, where either of the endpoints can be ommitted.
EOD
FloatRangeType =
CmdType.new('float-range', 
                                 :float_range, <<EOD)
A beginning:end range.
EOD
StringOrRegexp =
CmdType.new('regexp', 
                                 :string_or_regexp, <<EOD)
A plain string or a regular expression (the latter being enclosed 
within /.../).
EOD
DataPointType =

Data-point. Unlike other types, this one needs to be processed afterwards, actually, since an access to a plotmaker object is necessary.

CmdType.new('data-point', :data_point, <<EOD)
A point from a Dataset.

\todo document ;-)...
EOD
LaTeXFontType =

A LaTeX font

CmdType.new('latex-font', :latex_font, <<EOD)
A LaTeX font.

\todo document !
EOD
ColorMapType =

A color map

CmdType.new('colormap', :colormap, <<EOD)
A Z color map

\todo document !
EOD
StoredDatasetType =

A stored dataset.

CmdType.new('stored-dataset', 
                                    :string, <<EOD)
A dataset that has already been loaded. It is either:
 * A number, in which case it specifies the index inside the stack. 0
   is the first on that was pushed onto the stack (the oldest
   dataset), 1 the second, -1 the last one, -2 the one before the last
   and so on. (it works just like Ruby's arrays).
 * The name of a named dataset.
EOD
AxisType =

Something meant to be fed to PlotStyle#get_axis_style

CmdType.new('axis', :string, <<EOD)
The name of the axis of a plot. It can be:
 * @left@, @top@, @bottom@ or @right@;
 * @x@, @xaxis@, @y@, @yaxis@, which return one of the above depending 
   on the preferences of the current plot (see {command: xaxis} and 
   {command: yaxis} to change them);
 * one of the named axes, such as the ones created by 
   {command: new-zaxis}.
EOD
LabelType =

Something meant to be fed to PlotStyle#get_label_style

CmdType.new('label', :string, <<EOD)
The name of an label. It can be:
 * @title@ to mean the current plot's title.
 * @axis_tick@ or @axis_ticks@ or simply @axis@, where @axis@ is a a valid
   {type: axis}. It designates the ticks of the named axis.
 * @axis_label@, same as above but targets the label of the named axis.
EOD
GeneralGroup =

General scope commands.

CmdGroup.new('general', "General commands", 
"General scope commands", 1000)
CommandLineHelpOptions =
{
  'pager' => CmdArg.new('boolean')
}
CommandLineHelpCommand =

Display help on the command-line

Cmd.new("command-line-help", 'h', 
          "--help", [ ], CommandLineHelpOptions) do |plotmaker, options|
  plotmaker.interpreter.doc.display_command_line_help(options)
  exit 
end
PrintVersion =

Prints the version of ctioga2 used

Cmd.new("version", '-V', "--version", []) do |plotmaker|
  puts "This is ctioga2 version #{CTioga2::Version::version}"
end
RunCommandFile =

Includes a file

Cmd.new("include", '-f', "--file", 
          [ CmdArg.new('file'), ]) do |plotmaker, file|
  plotmaker.interpreter.run_command_file(file)
end
EvalCommand =

Evaluate a series of commands.

Cmd.new("eval", '-e', "--eval", 
                       [ CmdArg.new('commands'), ]) do |plotmaker, string|
  plotmaker.interpreter.run_commands(string)
end
VerboseLogging =

Increases verbosity

Cmd.new("verbose", '-v',  "--verbose", [ ]) do |plotmaker|
  CTioga2::Log::set_level(Logger::INFO)
end
DebugLogging =

Write debugging information.

todo this should be the place where a lot of customization of the debug output could go - including channels or things like that. To be seen later on…

Cmd.new("debug", nil,  "--debug", [ ]) do |plotmaker|
  CTioga2::Log::set_level(Logger::DEBUG)
end
EchoCmd =

Includes a file

Cmd.new("echo", nil,  "--echo", [ ]) do |plotmaker|
  STDERR.puts "Command-line used: "
  STDERR.puts plotmaker.quoted_command_line
end