ctioga2 0.0 → 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. data/Changelog +25 -1
  2. data/lib/ctioga2/commands/commands.rb +13 -2
  3. data/lib/ctioga2/commands/doc/doc.rb +13 -17
  4. data/lib/ctioga2/commands/doc/documentation-commands.rb +14 -1
  5. data/lib/ctioga2/commands/doc/help.rb +136 -25
  6. data/lib/ctioga2/commands/doc/html.rb +56 -4
  7. data/lib/ctioga2/commands/doc/introspection.rb +45 -9
  8. data/lib/ctioga2/commands/doc/man.rb +7 -5
  9. data/lib/ctioga2/commands/doc/markup.rb +39 -12
  10. data/lib/ctioga2/commands/doc/wordwrap.rb +70 -0
  11. data/lib/ctioga2/commands/general-commands.rb +7 -4
  12. data/lib/ctioga2/commands/general-types.rb +27 -12
  13. data/lib/ctioga2/commands/interpreter.rb +2 -2
  14. data/lib/ctioga2/commands/parsers/command-line.rb +9 -5
  15. data/lib/ctioga2/commands/parsers/file.rb +5 -3
  16. data/lib/ctioga2/commands/type.rb +10 -3
  17. data/lib/ctioga2/commands/variables.rb +2 -2
  18. data/lib/ctioga2/data/backends/backend.rb +17 -15
  19. data/lib/ctioga2/data/backends/backends.rb +2 -2
  20. data/lib/ctioga2/data/backends/backends/gnuplot.rb +20 -5
  21. data/lib/ctioga2/data/backends/backends/math.rb +2 -2
  22. data/lib/ctioga2/data/backends/backends/text.rb +112 -17
  23. data/lib/ctioga2/data/backends/description.rb +10 -11
  24. data/lib/ctioga2/data/datacolumn.rb +73 -14
  25. data/lib/ctioga2/data/dataset.rb +305 -9
  26. data/lib/ctioga2/data/filters.rb +49 -1
  27. data/lib/ctioga2/data/indexed-dtable.rb +137 -0
  28. data/lib/ctioga2/data/point.rb +98 -7
  29. data/lib/ctioga2/data/stack.rb +98 -21
  30. data/lib/ctioga2/graphics/coordinates.rb +19 -2
  31. data/lib/ctioga2/graphics/elements.rb +12 -2
  32. data/lib/ctioga2/graphics/elements/containers.rb +14 -2
  33. data/lib/ctioga2/graphics/elements/contour.rb +67 -0
  34. data/lib/ctioga2/graphics/elements/curve2d.rb +103 -42
  35. data/lib/ctioga2/graphics/elements/element.rb +12 -2
  36. data/lib/ctioga2/graphics/elements/gradient-region.rb +94 -0
  37. data/lib/ctioga2/graphics/elements/parametric2d.rb +172 -0
  38. data/lib/ctioga2/graphics/elements/primitive.rb +37 -21
  39. data/lib/ctioga2/graphics/elements/region.rb +143 -0
  40. data/lib/ctioga2/graphics/elements/subplot.rb +92 -32
  41. data/lib/ctioga2/graphics/elements/tangent.rb +99 -0
  42. data/lib/ctioga2/graphics/elements/xyz-map.rb +126 -0
  43. data/lib/ctioga2/graphics/generator.rb +91 -6
  44. data/lib/ctioga2/graphics/legends.rb +26 -21
  45. data/lib/ctioga2/graphics/legends/area.rb +8 -8
  46. data/lib/ctioga2/graphics/legends/items.rb +5 -5
  47. data/lib/ctioga2/graphics/legends/storage.rb +4 -2
  48. data/lib/ctioga2/graphics/root.rb +24 -2
  49. data/lib/ctioga2/graphics/styles.rb +8 -0
  50. data/lib/ctioga2/graphics/styles/axes.rb +49 -23
  51. data/lib/ctioga2/graphics/styles/base.rb +2 -2
  52. data/lib/ctioga2/graphics/styles/carrays.rb +9 -2
  53. data/lib/ctioga2/graphics/styles/colormap.rb +272 -0
  54. data/lib/ctioga2/graphics/styles/curve.rb +64 -4
  55. data/lib/ctioga2/graphics/styles/drawable.rb +68 -9
  56. data/lib/ctioga2/graphics/styles/errorbar.rb +73 -0
  57. data/lib/ctioga2/graphics/styles/factory.rb +133 -17
  58. data/lib/ctioga2/graphics/styles/gradients.rb +60 -0
  59. data/lib/ctioga2/graphics/styles/location.rb +64 -0
  60. data/lib/ctioga2/graphics/styles/map-axes.rb +164 -0
  61. data/lib/ctioga2/graphics/styles/plot.rb +165 -62
  62. data/lib/ctioga2/graphics/styles/sets.rb +14 -1
  63. data/lib/ctioga2/graphics/styles/texts.rb +44 -34
  64. data/lib/ctioga2/graphics/subplot-commands.rb +94 -6
  65. data/lib/ctioga2/graphics/types.rb +113 -35
  66. data/lib/ctioga2/graphics/types/bijection.rb +3 -3
  67. data/lib/ctioga2/graphics/types/boundaries.rb +120 -1
  68. data/lib/ctioga2/graphics/types/dimensions.rb +8 -1
  69. data/lib/ctioga2/graphics/types/grid.rb +196 -0
  70. data/lib/ctioga2/graphics/types/location.rb +228 -0
  71. data/lib/ctioga2/graphics/types/point.rb +2 -2
  72. data/lib/ctioga2/log.rb +18 -18
  73. data/lib/ctioga2/metabuilder/type.rb +15 -3
  74. data/lib/ctioga2/metabuilder/types.rb +2 -2
  75. data/lib/ctioga2/metabuilder/types/coordinates.rb +13 -1
  76. data/lib/ctioga2/metabuilder/types/data.rb +50 -0
  77. data/lib/ctioga2/metabuilder/types/generic.rb +60 -0
  78. data/lib/ctioga2/metabuilder/types/lists.rb +53 -16
  79. data/lib/ctioga2/metabuilder/types/styles.rb +26 -45
  80. data/lib/ctioga2/plotmaker.rb +91 -20
  81. data/lib/ctioga2/postprocess.rb +8 -8
  82. data/lib/ctioga2/utils.rb +23 -4
  83. metadata +107 -75
  84. data/lib/ctioga2/data/merge.rb +0 -43
@@ -16,24 +16,41 @@ require 'ctioga2/commands/commands'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 36 $', '$Date: 2009-05-04 21:23:15 +0200 (Mon, 04 May 2009) $')
19
+ Version::register_svn_info('$Revision: 238 $', '$Date: 2011-01-23 21:58:08 +0100 (Sun, 23 Jan 2011) $')
20
20
 
21
21
  module Commands
22
22
 
23
- # The base of the 'self-documentation' of CTioga2
24
23
  module Documentation
25
24
 
26
25
  # This class provides facilities to display information
27
26
  class Introspection
28
27
 
29
28
  # Display all known commands, along with their definition place
30
- def list_commands(raw = false)
31
- puts "Known commands:" unless raw
29
+ def list_commands(format = :pretty)
32
30
  cmds = Interpreter::commands
33
31
  names = cmds.keys.sort
34
- if raw
32
+ case format
33
+ when :list
35
34
  puts names
35
+ when :yaml
36
+ require 'yaml'
37
+ commands = {}
38
+ for n in names
39
+ cmd = cmds[n]
40
+ command = {}
41
+ command['name'] = n
42
+ f,l = cmd.context
43
+ command['file'] = f
44
+ command['line'] = l.to_i
45
+ command['long_option'] = cmd.long_option
46
+ command['short_option'] = cmd.short_option
47
+ command['short_description'] = cmd.short_description
48
+ command['long_description'] = cmd.long_description
49
+ commands[n] = command
50
+ end
51
+ puts YAML.dump(commands)
36
52
  else
53
+ puts "Known commands:"
37
54
  max = names.inject(0) {|m,x| [m,x.size].max}
38
55
  max2 = names.inject(0) {|m,x| [m,cmds[x].long_option.size].max}
39
56
  for n in names
@@ -112,17 +129,36 @@ module CTioga2
112
129
 
113
130
  end
114
131
 
132
+ InternalFormatRE = {
133
+ /list|raw/i => :list,
134
+ /default|pretty/i => :pretty,
135
+ /yaml/i => :yaml
136
+ }
137
+
138
+
139
+ InternalFormatType = CmdType.new('internal-format',
140
+ { :type => :re_list,
141
+ :list => InternalFormatRE}, <<EOD)
142
+ Output format for internals.
143
+ EOD
144
+
145
+
115
146
  IntrospectionGroup =
116
147
  CmdGroup.new('introspection', "Introspection",
117
- "Displays information about the internals of ctioga2",
118
- 100, true)
148
+ <<EOD, 100)
149
+ Commands displaying information about the internals of ctioga2, such
150
+ as known types/commands/backends...
151
+ EOD
119
152
 
153
+ TypeOption = {'format' => CmdArg.new('internal-format')}
120
154
  RawOption = {'raw' => CmdArg.new('boolean')}
121
155
 
122
156
  ListCommandsCmd =
123
157
  Cmd.new('list-commands', nil, '--list-commands',
124
- [], RawOption) do |p, opts|
125
- Introspection.new.list_commands(opts['raw'])
158
+ [], RawOption.dup.update(TypeOption)) do |p, opts|
159
+ opts['format'] = :list if opts['raw']
160
+
161
+ Introspection.new.list_commands(opts['format'])
126
162
  end
127
163
 
128
164
  ListCommandsCmd.describe("List known commands",
@@ -18,7 +18,7 @@ require 'ctioga2/commands/parsers/command-line'
18
18
 
19
19
  module CTioga2
20
20
 
21
- Version::register_svn_info('$Revision: 40 $', '$Date: 2009-05-08 00:45:47 +0200 (Fri, 08 May 2009) $')
21
+ Version::register_svn_info('$Revision: 213 $', '$Date: 2010-12-31 02:50:00 +0100 (Fri, 31 Dec 2010) $')
22
22
 
23
23
  module Commands
24
24
 
@@ -45,6 +45,7 @@ module CTioga2
45
45
  #
46
46
  # NO... We should *input* a manual page, and spit out
47
47
  # replacement texts.
48
+ #
48
49
  def write_manual_page(version, input, out = STDOUT)
49
50
  passed_header = false
50
51
  if input.is_a? String
@@ -67,12 +68,13 @@ module CTioga2
67
68
  passed_header = true
68
69
  when /^#{RoffCommentRE}\s*write-commands\s*$/
69
70
  write_commands(out)
71
+ # \todo add a write-backends command....
70
72
  when /^#{RoffCommentRE}\s*write-group:\s*(.*)\s*$/
71
73
  id = $1
72
74
  if @groups[id]
73
75
  write_group(out, g)
74
76
  else
75
- warn "Unkown group: #{id}"
77
+ warn { "Unkown group: #{id}" }
76
78
  end
77
79
  when /^#{RoffCommentRE}\s*write-types\s*$/
78
80
  write_types(out)
@@ -97,12 +99,12 @@ module CTioga2
97
99
  # equivalent in roff format. Alternativelely, it can take a
98
100
  # String and feed it to MarkedUpText.
99
101
  #
100
- # TODO: make sure things are escaped the way they should be.
102
+ # \todo make sure things are escaped the way they should be.
101
103
  #
102
104
  # if _inside_cmds_ is true, additional indentation is added
103
105
  # for the lists, so that is looks neat in the end.
104
106
  #
105
- # TODO: try to be more clever about spaces in the target
107
+ # \todo try to be more clever about spaces in the target
106
108
  # file. (does not matter too much for the output of man)
107
109
  def markup_to_man(items, inside_cmds = true)
108
110
  if items.is_a? String
@@ -242,7 +244,7 @@ module CTioga2
242
244
  def write_type(out, type, indent = "")
243
245
  out.puts ".TP #{indent}"
244
246
  out.puts ".I #{type.name}"
245
- out.puts "#{type.description}"
247
+ out.puts markup_to_man(type.description)
246
248
  end
247
249
 
248
250
  # Returns the header string
@@ -16,14 +16,18 @@ require 'ctioga2/log'
16
16
 
17
17
  module CTioga2
18
18
 
19
- Version::register_svn_info('$Revision: 84 $', '$Date: 2009-06-12 00:09:41 +0200 (Fri, 12 Jun 2009) $')
19
+ Version::register_svn_info('$Revision: 216 $', '$Date: 2010-12-31 16:18:17 +0100 (Fri, 31 Dec 2010) $')
20
20
 
21
21
  module Commands
22
22
 
23
23
  module Documentation
24
24
 
25
25
  # The documentation strings are written in a simple markup
26
- # language.
26
+ # language.
27
+ #
28
+ # \todo we should provide tags to specifically mark TODO items
29
+ # in documentation, in such a way that it would be easy to make
30
+ # a list of them, and possibly ignore it for output.
27
31
  class MarkedUpText
28
32
 
29
33
  # Do we really need logging ?
@@ -48,16 +52,18 @@ module CTioga2
48
52
  end
49
53
 
50
54
  # A markup item representing plain text.
51
- #
52
- # TODO: in to_s a simple word-wrapping algorithm could be
53
- # used.
54
55
  class MarkupText < MarkupItem
55
56
  # The text
56
57
  attr_accessor :text
57
58
 
58
- def initialize(doc, text = "", strip = true)
59
+ # The kind of markup, nil means no markup
60
+ attr_accessor :kind
61
+
62
+ def initialize(doc, text = "", strip = true,
63
+ kind = nil)
59
64
  super(doc)
60
65
  @text = text
66
+ @kind = kind
61
67
  if strip
62
68
  @text.gsub!(/\n/, " ")
63
69
  end
@@ -104,15 +110,23 @@ module CTioga2
104
110
  attr_accessor :target
105
111
 
106
112
  # _target_ is the name of the target, which can be of _type_
107
- # 'group', 'command' and 'type'.
113
+ # 'group', 'command', 'backend', 'type' and 'url'
108
114
  def initialize(doc, target, type)
109
115
  super(doc)
110
- @target = doc.send("#{type}s")[target]
116
+ if type =~ /url/
117
+ @target = target
118
+ else
119
+ @target = doc.send("#{type}s")[target]
120
+ end
111
121
  end
112
122
 
113
123
  def to_s
114
- if @target
115
- return @target.name
124
+ if @target
125
+ begin
126
+ return @target.name
127
+ rescue NoMethodError
128
+ return @target
129
+ end
116
130
  else
117
131
  return "unknown"
118
132
  end
@@ -215,6 +229,9 @@ module CTioga2
215
229
  # * a {group: ...} or {type: ...} or {command: ...} is a link
216
230
  # to the element.
217
231
  # * a blank line marks a paragraph break.
232
+ #
233
+ # \todo Add elements to do some inline markup (such as bold,
234
+ # code, italics; mostly code for now will do very fine)
218
235
  def parse_from_string(string)
219
236
  @last_type = nil
220
237
  @last_string = ""
@@ -263,15 +280,25 @@ module CTioga2
263
280
 
264
281
  protected
265
282
 
283
+ # A few constants to help writing out the paragraph markup
284
+ LinkRE = /\{(group|type|command|backend|url):\s*([^}]+?)\s*\}/
285
+
286
+ MarkOnceRE = /@([^@]+)@/
287
+
288
+
266
289
  # Parses the markup found within a paragraph (ie: links and
267
290
  # other text attributes, but not verbatim, list or other
268
291
  # markings) and returns an array containing the MarkupItem
269
292
  # elements.
270
293
  def parse_paragraph_markup(doc, string)
271
294
  els = []
272
- while string =~ /\{(group|type|command):\s*([^}]+?)\s*\}/
295
+ while string =~ /#{LinkRE}|#{MarkOnceRE}/
273
296
  els << MarkupText.new(doc, $`)
274
- els << MarkupLink.new(doc, $2, $1)
297
+ if $1
298
+ els << MarkupLink.new(doc, $2, $1)
299
+ elsif $3
300
+ els << MarkupText.new(doc, $3, true, :code)
301
+ end
275
302
  string = $'
276
303
  end
277
304
  els << MarkupText.new(doc, string)
@@ -0,0 +1,70 @@
1
+ ## \file wordwrap.rb small word-wrapping utility
2
+ # copyright (c) 2009 by Vincent Fourmond
3
+
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # (at your option) any later version.
8
+
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details (in the COPYING file).
13
+
14
+ require 'ctioga2/utils'
15
+ require 'ctioga2/commands/commands'
16
+ require 'ctioga2/commands/parsers/command-line'
17
+
18
+ module CTioga2
19
+
20
+ Version::register_svn_info('$Revision: 131 $', '$Date: 2010-01-14 22:51:09 +0100 (Thu, 14 Jan 2010) $')
21
+
22
+ module Commands
23
+
24
+ module Documentation
25
+
26
+
27
+ # A small utility class to do word wrapping.
28
+ #
29
+ # \todo Maybe this belongs in Utils ?
30
+ class WordWrapper
31
+
32
+ # A regex matching word separation.
33
+ attr_accessor :word_sep
34
+
35
+ # What to replace the separator with
36
+ attr_accessor :new_sep
37
+
38
+ def initialize(ws = /\s+/, ns = " ")
39
+ @word_sep = ws
40
+ @new_sep = ns
41
+ end
42
+
43
+ # Split strings into an array of string whose length is each
44
+ # less than _cols_
45
+ def wrap(str, cols)
46
+ words = str.split(@word_sep)
47
+ lines = [words.shift]
48
+ while w = words.shift
49
+ if (lines.last.size + w.size + @new_sep.size) <= cols
50
+ lines.last.concat("#{@new_sep}#{w}")
51
+ else
52
+ lines << w
53
+ end
54
+ end
55
+ return lines
56
+ end
57
+
58
+ # Calls #wrap for default values of the parameters
59
+ def self.wrap(str, cols)
60
+ return WordWrapper.new.wrap(str, cols)
61
+ end
62
+
63
+ end
64
+
65
+
66
+ end
67
+
68
+ end
69
+
70
+ end
@@ -17,7 +17,7 @@ require 'ctioga2/commands/parsers/file'
17
17
 
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision: 55 $', '$Date: 2009-05-27 00:01:34 +0200 (Wed, 27 May 2009) $')
20
+ Version::register_svn_info('$Revision: 155 $', '$Date: 2010-06-21 21:41:32 +0200 (Mon, 21 Jun 2010) $')
21
21
 
22
22
  module Commands
23
23
 
@@ -27,12 +27,15 @@ module CTioga2
27
27
  "General scope commands", 1000)
28
28
 
29
29
 
30
+ CommandLineHelpOptions = {
31
+ 'pager' => CmdArg.new('boolean')
32
+ }
30
33
 
31
34
  # Display help on the command-line
32
35
  CommandLineHelpCommand =
33
36
  Cmd.new("command-line-help", 'h',
34
- "--help", [ ]) do |plotmaker|
35
- plotmaker.interpreter.doc.display_command_line_help
37
+ "--help", [ ], CommandLineHelpOptions) do |plotmaker, options|
38
+ plotmaker.interpreter.doc.display_command_line_help(options)
36
39
  exit
37
40
  end
38
41
 
@@ -85,7 +88,7 @@ EOH
85
88
 
86
89
  # Write debugging information.
87
90
  #
88
- # TODO: this should be the place where a lot of customization of
91
+ # \todo this should be the place where a lot of customization of
89
92
  # the debug output could go - including channels or things like
90
93
  # that. To be seen later on...
91
94
  DebugLogging =
@@ -15,7 +15,7 @@ require 'ctioga2/utils'
15
15
 
16
16
  module CTioga2
17
17
 
18
- Version::register_svn_info('$Revision: 101 $', '$Date: 2009-07-21 23:29:59 +0200 (Tue, 21 Jul 2009) $')
18
+ Version::register_svn_info('$Revision: 223 $', '$Date: 2011-01-11 01:07:48 +0100 (Tue, 11 Jan 2011) $')
19
19
 
20
20
  module Commands
21
21
 
@@ -73,16 +73,29 @@ EOD
73
73
  # Data-point. Unlike other types, this one needs to be processed
74
74
  # afterwards, actually, since an access to a plotmaker object is
75
75
  # necessary.
76
- DataPointType = CmdType.new('data-point', :string, <<EOD)
76
+ DataPointType = CmdType.new('data-point', :data_point, <<EOD)
77
77
  A point from a Dataset.
78
78
 
79
- TODO: document ;-)...
79
+ \todo document ;-)...
80
80
  EOD
81
81
 
82
+ # A LaTeX font
83
+ LaTeXFontType = CmdType.new('latex-font', :latex_font, <<EOD)
84
+ A LaTeX font.
82
85
 
86
+ \todo document !
87
+ EOD
88
+
89
+ # A color map
90
+ ColorMapType = CmdType.new('colormap', :colormap, <<EOD)
91
+ A Z color map
92
+
93
+ \todo document !
94
+ EOD
83
95
 
84
96
  # This ones get here since they mess up with syntax highlighting
85
97
 
98
+
86
99
  # A stored dataset.
87
100
  StoredDatasetType = CmdType.new('stored-dataset',
88
101
  :string, <<EOD)
@@ -96,20 +109,22 @@ EOD
96
109
 
97
110
  # Something meant to be fed to PlotStyle#get_axis_style
98
111
  AxisType = CmdType.new('axis', :string, <<EOD)
99
- The name of an axis. It can be:
100
- * left, top, bottom or right;
101
- * x, xaxis, y, yaxis, which return one of the above depending
102
- on the preferences of the current plot;
103
- * one of the named axes.
112
+ The name of the axis of a plot. It can be:
113
+ * @left@, @top@, @bottom@ or @right@;
114
+ * @x@, @xaxis@, @y@, @yaxis@, which return one of the above depending
115
+ on the preferences of the current plot (see {command: xaxis} and
116
+ {command: yaxis} to change them);
117
+ * one of the named axes, such as the ones created by
118
+ {command: new-zaxis}.
104
119
  EOD
105
120
 
106
121
  # Something meant to be fed to PlotStyle#get_label_style
107
122
  LabelType = CmdType.new('label', :string, <<EOD)
108
123
  The name of an label. It can be:
109
- * title to mean the current plot's title.
110
- * axis_tick or axis_ticks or simply axis, where axis is a a valid
111
- {type: axis}. It means the ticks of the given axis.
112
- * axis_label, same as above but targets the label of the given axis.
124
+ * @title@ to mean the current plot's title.
125
+ * @axis_tick@ or @axis_ticks@ or simply @axis@, where @axis@ is a a valid
126
+ {type: axis}. It designates the ticks of the named axis.
127
+ * @axis_label@, same as above but targets the label of the named axis.
113
128
  EOD
114
129
 
115
130
 
@@ -20,7 +20,7 @@ require 'ctioga2/commands/doc/doc'
20
20
 
21
21
  module CTioga2
22
22
 
23
- Version::register_svn_info('$Revision: 18 $', '$Date: 2009-04-28 23:43:54 +0200 (Tue, 28 Apr 2009) $')
23
+ Version::register_svn_info('$Revision: 155 $', '$Date: 2010-06-21 21:41:32 +0200 (Mon, 21 Jun 2010) $')
24
24
 
25
25
  # This module contains the real core of ctioga2: a set of classes
26
26
  # that implement the concept of commands. Each command translates
@@ -169,7 +169,7 @@ module CTioga2
169
169
  # snapshot of the current commands known to the system, so
170
170
  # please instantiate it last.
171
171
  #
172
- # TODO: probably this behavior is not really desired.
172
+ # \todo probably this behavior is not really desired.
173
173
  # Easy to fix.
174
174
  def initialize(target)
175
175
  @plotmaker_target = target
@@ -17,7 +17,7 @@ require 'ctioga2/commands/commands'
17
17
 
18
18
  module CTioga2
19
19
 
20
- Version::register_svn_info('$Revision: 2 $', '$Date: 2009-04-25 14:03:30 +0200 (Sat, 25 Apr 2009) $')
20
+ Version::register_svn_info('$Revision: 151 $', '$Date: 2010-06-19 23:45:20 +0200 (Sat, 19 Jun 2010) $')
21
21
 
22
22
  module Commands
23
23
 
@@ -164,13 +164,17 @@ module CTioga2
164
164
  end
165
165
 
166
166
  # We try and go fishing for options, in the form
167
- # /option=stuff.
168
- while argv.first =~ /^\/([\w-]+)=(.*)/
167
+ # /option=stuff, or /option stuff...
168
+ while argv.first =~ /^\/([\w-]+)(?:=(.*))?$/
169
169
  if command.has_option? $1
170
- options[$1] = $2
171
170
  argv.shift
171
+ if $2
172
+ options[$1] = $2
173
+ else
174
+ options[$1] = argv.shift
175
+ end
172
176
  else
173
- warn "Argument #{argv.first} looks like an option, but does not match any of the command #{command.name}"
177
+ warn { "Argument #{argv.first} looks like an option, but does not match any of the command #{command.name}" }
174
178
  break
175
179
  end
176
180
  end