Skip to content

Commit 8f11a11

Browse files
committed
Merge pull request #19 from rjmacready/tiny_fixes
using print-object so that we can have nicer error/help messages just by...
2 parents 0fe7ed3 + 62bf9bf commit 8f11a11

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

command-interface/command-interface-library.dylan

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ define module command-interface
2626
use format-out,
2727
import: { format-out, force-out,
2828
format-err, force-err };
29+
use print;
2930
use streams,
3031
import: { force-output };
3132
use tty;

command-interface/nodes.dylan

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ define class <symbol-node> (<parse-node>)
144144
init-keyword: symbol:;
145145
end class;
146146

147+
define method print-object(object :: <symbol-node>, stream :: <stream>) => ();
148+
format(stream, "%s", node-symbol(object));
149+
end method;
150+
147151
define method node-match (node :: <symbol-node>, parser :: <command-parser>, token :: <command-token>)
148152
=> (matched? :: <boolean>);
149153
starts-with?(as(<string>, node-symbol(node)),
@@ -178,6 +182,10 @@ define open class <command-node> (<symbol-node>)
178182
slot command-simple-parameters :: <list> = #();
179183
end class;
180184

185+
define method print-object(object :: <command-node>, stream :: <stream>) => ();
186+
format(stream, "%s - %s", node-symbol(object), command-help(object));
187+
end method;
188+
181189
define method node-accept (node :: <command-node>, parser :: <command-parser>, token :: <command-token>)
182190
=> ();
183191
if (command-handler(node))

0 commit comments

Comments
 (0)