-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" } "." } ;
{ $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"
}
"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 ;"
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>" }
: (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 ] [
] 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 [
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]
-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 ;