Skip to content

Commit

Permalink
[console] Allow showing properties from command line.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
waywardmonkeys committed Jun 29, 2015
1 parent 5e1f14b commit c9b8005
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sources/environment/commands/properties.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ define method parameter-type-name
"property"
end method parameter-type-name;

define method parse-next-argument
(context :: <server-context>, type == <command-property>, text :: <string>,
#key start :: <integer> = 0, end: stop = #f)
=> (value :: <command-property>, next-index :: <integer>)
let (name, next-index)
= parse-next-word(text, start: start, end: stop);
if (name)
values(find-named-property(context, as(<symbol>, name)), next-index)
else
parse-error("Missing keyword argument")
end
end method parse-next-argument;

define open generic ensure-property-available
(context :: <server-context>, property :: <command-property>)
=> ();
Expand Down
4 changes: 4 additions & 0 deletions sources/environment/console/command-line.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ define abstract class <basic-main-command> (<basic-command>)
init-keyword: internal-debug:;
constant slot %project :: false-or(<file-locator>) = #f,
init-keyword: project:;
constant slot %show :: false-or(<command-property>) = #f,
init-keyword: show:;
constant slot %help? :: <boolean> = #f,
init-keyword: help?:;
constant slot %logo? :: <boolean> = #f,
Expand Down Expand Up @@ -169,6 +171,8 @@ define method do-execute-command
run(<version-command>)
elseif (command.%shortversion?)
run(<version-command>, short: "short")
elseif (command.%show)
run(<show-property-command>, property: command.%show);
else
command.%logo? & message(context, dylan-banner());
let personal-root = command.%personal-root;
Expand Down
2 changes: 2 additions & 0 deletions sources/environment/console/compiler-command-line.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ define command-line main => <main-command>
flag echo-input = "echoes all input to the console";
flag verbose = "show verbose output";

keyword show :: <command-property> = "show a compiler setting";

flag import = "import the project";
flag build = "build the project";
flag compile = "compile the project";
Expand Down
2 changes: 2 additions & 0 deletions sources/environment/console/environment-command-line.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ define command-line main => <main-command>
flag debugger = "enter the debugger if this program crashes";
flag echo-input = "echoes all input to the console";

keyword show :: <command-property> = "show a compiler setting";

flag import = "import the project";
flag build = "build the project";
flag compile = "compile the project";
Expand Down

0 comments on commit c9b8005

Please sign in to comment.