Skip to content

Commit c9b8005

Browse files
[console] Allow showing properties from command line.
* sources/environment/commands/properties.dylan (parse-next-argument on <command-property>): New method for parsing an argument and converting it to a <command-property>. * sources/environment/console/command-line.dylan (class <basic-main-command>): Add slot for %show. (do-execute-command): Handle -show being passed by invoking the show property command. * sources/environment/console/compiler-command-line.dylan (command-line main): Add new show keyword parameter. * sources/environment/console/environment-command-line.dylan (command-line main): Add new show keyword parameter.
1 parent 5e1f14b commit c9b8005

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

sources/environment/commands/properties.dylan

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ define method parameter-type-name
2020
"property"
2121
end method parameter-type-name;
2222

23+
define method parse-next-argument
24+
(context :: <server-context>, type == <command-property>, text :: <string>,
25+
#key start :: <integer> = 0, end: stop = #f)
26+
=> (value :: <command-property>, next-index :: <integer>)
27+
let (name, next-index)
28+
= parse-next-word(text, start: start, end: stop);
29+
if (name)
30+
values(find-named-property(context, as(<symbol>, name)), next-index)
31+
else
32+
parse-error("Missing keyword argument")
33+
end
34+
end method parse-next-argument;
35+
2336
define open generic ensure-property-available
2437
(context :: <server-context>, property :: <command-property>)
2538
=> ();

sources/environment/console/command-line.dylan

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ define abstract class <basic-main-command> (<basic-command>)
1919
init-keyword: internal-debug:;
2020
constant slot %project :: false-or(<file-locator>) = #f,
2121
init-keyword: project:;
22+
constant slot %show :: false-or(<command-property>) = #f,
23+
init-keyword: show:;
2224
constant slot %help? :: <boolean> = #f,
2325
init-keyword: help?:;
2426
constant slot %logo? :: <boolean> = #f,
@@ -169,6 +171,8 @@ define method do-execute-command
169171
run(<version-command>)
170172
elseif (command.%shortversion?)
171173
run(<version-command>, short: "short")
174+
elseif (command.%show)
175+
run(<show-property-command>, property: command.%show);
172176
else
173177
command.%logo? & message(context, dylan-banner());
174178
let personal-root = command.%personal-root;

sources/environment/console/compiler-command-line.dylan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ define command-line main => <main-command>
2828
flag echo-input = "echoes all input to the console";
2929
flag verbose = "show verbose output";
3030

31+
keyword show :: <command-property> = "show a compiler setting";
32+
3133
flag import = "import the project";
3234
flag build = "build the project";
3335
flag compile = "compile the project";

sources/environment/console/environment-command-line.dylan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ define command-line main => <main-command>
103103
flag debugger = "enter the debugger if this program crashes";
104104
flag echo-input = "echoes all input to the console";
105105

106+
keyword show :: <command-property> = "show a compiler setting";
107+
106108
flag import = "import the project";
107109
flag build = "build the project";
108110
flag compile = "compile the project";

0 commit comments

Comments
 (0)