Allow specifying vocabulary roots on the command line

Fixes #1498
db4
Benjamin Pollack 2016-03-03 14:24:54 -05:00 committed by Doug Coleman
parent 9a4fc29c07
commit 37f047c1df
4 changed files with 10 additions and 0 deletions

View File

@ -98,6 +98,7 @@ Common arguments:
-run=ui.tools run Factor development UI
-e=<code> evaluate <code>
-no-user-init suppress loading of .factor-rc
-roots=<paths> a list of path-delimited extra vocab roots
Enter
"command-line" help

View File

@ -30,3 +30,7 @@ IN: command-line
{ "factor" "-foo" "a" "b" "c" } parse-command-line
executable get script get command-line get
] unit-test
{ "a:b:c" } [ { "factor" "-roots=a:b:c" } parse-command-line
"roots" get-global
] unit-test

View File

@ -48,6 +48,10 @@ SYMBOL: command-line
".factor-roots" rc-path dup exists? [
utf8 file-lines harvest [ add-vocab-root ] each
] [ drop ] if
"roots" get [
os windows? ";" ":" ?
split [ add-vocab-root ] each
] when*
] when ;
: var-param ( name value -- ) swap set-global ;

View File

@ -27,6 +27,7 @@ Common arguments:
-fep enter fep mode immediately
-nosignals turn off OS signal handling
-console open console if possible
-roots=<paths> a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots
Enter
\"command-line\" help