command-line: cleanup some documentation, change terminology slightly.

Refer to "options" instead of "VM args" or "Factor arguments".
master
John Benediktsson 2020-09-26 10:52:32 -07:00
parent 5a71d98d29
commit 7bd1adb1c3
4 changed files with 13 additions and 23 deletions

View File

@ -1,11 +1,11 @@
USING: help.markup help.syntax strings system vocabs vocabs.loader ;
USING: help.markup help.syntax io.pathnames strings system vocabs vocabs.loader ;
IN: command-line
HELP: run-bootstrap-init
{ $description "Runs the bootstrap initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
{ $description "Runs the bootstrap initialization file in the user's " { $link home } " directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-boot-rc" } "." } ;
HELP: run-user-init
{ $description "Runs the startup initialization file in the user's home directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-rc" } "." } ;
{ $description "Runs the startup initialization file in the user's " { $link home } " directory, unless the " { $snippet "-no-user-init" } " command line switch was given. This file is named " { $snippet ".factor-rc" } "." } ;
HELP: load-vocab-roots
{ $description "Loads the newline-separated list of additional vocabulary roots from the file named " { $snippet ".factor-roots" } "." } ;
@ -117,7 +117,7 @@ $nl
{ $subsections load-vocab-roots } ;
ARTICLE: "rc-files" "Running code on startup"
"Factor looks for three optional files in your home directory."
"Factor looks for three optional files in the user's " { $link home } " directory."
{ $subsections
".factor-boot-rc"
".factor-rc"
@ -125,12 +125,6 @@ ARTICLE: "rc-files" "Running code on startup"
}
"The " { $snippet "-no-user-init" } " command line switch will inhibit loading running of these files."
$nl
"If you are unsure where the files should be located, evaluate the following code:"
{ $code
"USE: command-line"
"\".factor-rc\" rc-path print"
"\".factor-boot-rc\" rc-path print"
}
"Here is an example " { $snippet ".factor-boot-rc" } " which sets up your developer name:"
{ $code
"USING: tools.scaffold namespaces ;"
@ -139,8 +133,8 @@ $nl
ARTICLE: "command-line" "Command line arguments"
"Factor command line usage:"
{ $code "factor [VM args...] [script] [args...]" }
"Zero or more VM arguments can be passed in, followed by an optional script file name. If the script file is specified, it will be run on startup using " { $link run-script } ". Any arguments after the script file are stored in the following variable, with no further processing by Factor itself:"
{ $code "factor [options] [script] [arguments]" }
"Zero or more options can be passed in, followed by an optional script file name. If the script file is specified, it will be run on startup using " { $link run-script } ". Any arguments after the script file are stored in the following variable, with no further processing by Factor itself:"
{ $subsections command-line }
"Instead of running a script, it is also possible to run a vocabulary; this invokes the vocabulary's " { $link POSTPONE: MAIN: } " word:"
{ $code "factor [system switches...] -run=<vocab name>" }

View File

@ -24,9 +24,6 @@ SYMBOL: command-line
: (command-line) ( -- args )
OBJ-ARGS special-object sift [ alien>native-string ] map ;
: rc-path ( name -- path )
home prepend-path ;
: try-user-init ( file -- )
"user-init" get swap '[
_ [ ?run-file ] [
@ -37,14 +34,14 @@ SYMBOL: command-line
] when ;
: run-bootstrap-init ( -- )
".factor-boot-rc" rc-path try-user-init ;
"~/.factor-boot-rc" try-user-init ;
: run-user-init ( -- )
".factor-rc" rc-path try-user-init ;
"~/.factor-rc" try-user-init ;
: load-vocab-roots ( -- )
"user-init" get [
".factor-roots" rc-path dup exists? [
"~/.factor-roots" dup exists? [
utf8 file-lines harvest [ add-vocab-root ] each
] [ drop ] if
"roots" get [

View File

@ -9,9 +9,9 @@ IN: command-line.startup
os windows? [ script get "/?" = or ] when ;
: help. ( -- )
"Usage: " write vm-path file-name write " [Factor arguments] [script] [script arguments]
"Usage: " write vm-path file-name write " [options] [script] [arguments]
Factor arguments:
Options:
-help print this message and exit
-version print the Factor version and exit
-i=<image> load Factor image file <image> [" write vm-path file-stem write ".image]
@ -32,12 +32,11 @@ Factor arguments:
-fep enter fep mode immediately
-no-signals turn off OS signal handling
-console open console if possible
-roots=<paths> a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots
-roots=<paths> '" write os windows? ";" ":" ? write "'-separated list of extra vocab root directories
Enter
\"command-line\" help
from within Factor for more information.
" write ;
: version? ( -- ? ) "version" get ;

View File

@ -100,7 +100,7 @@ M: method word-vocabulary "method-generic" word-prop word-vocabulary ;
: run-mason-rc ( -- )
t "user-init" [
".factor-mason-rc" rc-path try-user-init
"~/.factor-mason-rc" try-user-init
] with-variable ;
: check-user-init-errors ( -- ? )