command-set 0.8.4 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -49,7 +49,7 @@ module StdCmd
49
49
  puts docline
50
50
  end
51
51
  else
52
- command,remains = subject.command_set.find_command(*terms)
52
+ command = subject.command_set.find_command(terms)
53
53
  docs = command.documentation(width)
54
54
  docs.each do |docline|
55
55
  puts docline
@@ -129,20 +129,11 @@ module StdCmd
129
129
  def self.define_commands
130
130
  return @@set ||= Command::CommandSet.define_commands do
131
131
  root_command do
132
- argument(Command::FiddlyArgument.new(:mode) do |argument|
133
- argument.completion do |t,s|
134
- []
135
- end
136
-
137
- argument.validation do |term,s|
138
- Command::CommandSet === term
139
- end
140
- end)
141
132
  subject_methods :interpreter
142
133
  doesnt_undo
143
134
 
144
135
  action do
145
- subject.interpreter.push_mode(mode)
136
+ subject.interpreter.push_mode(parent)
146
137
  end
147
138
  end
148
139
 
@@ -32,7 +32,8 @@ module Command
32
32
  UndefinedField === instance_variable_get(var)
33
33
  end
34
34
  unless missing.empty?
35
- raise RuntimeError, "Undefined fields: #{missing.join(", ")}"
35
+ missing.map! {|m| m.sub(/^@/,"")}
36
+ raise RuntimeError, "Undefined subject field#{missing.length > 1 ? "s" : ""}: #{missing.join(", ")}"
36
37
  end
37
38
  return nil
38
39
  end
@@ -77,14 +78,17 @@ class SubjectImage
77
78
  #You shouldn't really need to ever call this - it's used by the
78
79
  #interpreter to set up the image before it's passed to the command
79
80
  def add_field(name, value)
80
- meta = class << self; self; end
81
-
82
- meta.instance_eval do
83
- define_method("#{name}") do
84
- return value
81
+ (class << self; self; end).instance_eval do
82
+ define_method("#{name}") do
83
+ return value
84
+ end
85
85
  end
86
86
  end
87
- end
87
+
88
+ def get_image(fields)
89
+ #TODO: fail if I don't respond to a field
90
+ return self
91
+ end
88
92
  end
89
93
 
90
94
 
@@ -119,7 +119,7 @@ module Command
119
119
  if(@complete_line)
120
120
  new_line = []
121
121
  line.each do |word|
122
- word = complete(word, new_line)
122
+ word = complete(word, new_line.dup)
123
123
  new_line << word
124
124
  end
125
125
  line = new_line
@@ -134,7 +134,7 @@ module Command
134
134
  list = current_command_set.completion_list(line, word, build_subject)
135
135
 
136
136
  if list.length == 0
137
- raise CommandException, "Unrecognized: #{word}"
137
+ raise CommandException, "Unrecognized term: #{word}"
138
138
  end
139
139
 
140
140
  return word if list[-1].empty?
@@ -142,7 +142,7 @@ module Command
142
142
  if list.length == 1
143
143
  return list[0]
144
144
  else
145
- raise CommandException, "Ambiguous: #{word}"
145
+ raise CommandException, "Ambiguous term: #{word}"
146
146
  end
147
147
  end
148
148
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: command-set
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.8.4
7
- date: 2007-12-20 00:00:00 -08:00
6
+ version: 0.9.0
7
+ date: 2008-01-08 00:00:00 -08:00
8
8
  summary: Framework for interactive programs focused around a DSL for commands
9
9
  require_paths:
10
10
  - lib
@@ -33,6 +33,7 @@ files:
33
33
  - lib/command-set
34
34
  - lib/command-set/command-set.rb
35
35
  - lib/command-set/arguments.rb
36
+ - lib/command-set/command-common.rb
36
37
  - lib/command-set/og.rb
37
38
  - lib/command-set/text-interpreter.rb
38
39
  - lib/command-set/subject.rb
@@ -51,12 +52,11 @@ files:
51
52
  test_files: []
52
53
 
53
54
  rdoc_options:
54
- - --diagram
55
55
  - --inline-source
56
56
  - --main
57
57
  - Command
58
58
  - --title
59
- - command-set-0.8.4 RDoc
59
+ - command-set-0.9.0 RDoc
60
60
  extra_rdoc_files:
61
61
  - doc/README
62
62
  - doc/GUIDED_TOUR