Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[console] Allow showing properties from command line. #934

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -104,6 +104,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