From: Benjamin Pollack Date: Thu, 3 Mar 2016 19:24:54 +0000 (-0500) Subject: Allow specifying vocabulary roots on the command line X-Git-Tag: unmaintained~1603 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=37f047c1dfb9994b9a017c6a2a3b721ca1eb7e24 Allow specifying vocabulary roots on the command line Fixes #1498 --- diff --git a/README.md b/README.md index bcc4e434b2..1abecf2bca 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ Common arguments: -run=ui.tools run Factor development UI -e= evaluate -no-user-init suppress loading of .factor-rc + -roots= a list of path-delimited extra vocab roots Enter "command-line" help diff --git a/basis/command-line/command-line-tests.factor b/basis/command-line/command-line-tests.factor index 36943a2a58..4652c1d066 100644 --- a/basis/command-line/command-line-tests.factor +++ b/basis/command-line/command-line-tests.factor @@ -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 diff --git a/basis/command-line/command-line.factor b/basis/command-line/command-line.factor index 44ff0c0c12..9d4ccda7f3 100644 --- a/basis/command-line/command-line.factor +++ b/basis/command-line/command-line.factor @@ -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 ; diff --git a/basis/command-line/startup/startup.factor b/basis/command-line/startup/startup.factor index f3df3d7f1a..726a369a9c 100644 --- a/basis/command-line/startup/startup.factor +++ b/basis/command-line/startup/startup.factor @@ -27,6 +27,7 @@ Common arguments: -fep enter fep mode immediately -nosignals turn off OS signal handling -console open console if possible + -roots= a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots Enter \"command-line\" help