diff --git a/basis/command-line/command-line-docs.factor b/basis/command-line/command-line-docs.factor index 99c629877b..82ffe45e2b 100644 --- a/basis/command-line/command-line-docs.factor +++ b/basis/command-line/command-line-docs.factor @@ -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=" } diff --git a/basis/command-line/command-line.factor b/basis/command-line/command-line.factor index aeb26c8e5e..39217ce61d 100644 --- a/basis/command-line/command-line.factor +++ b/basis/command-line/command-line.factor @@ -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 [ diff --git a/basis/command-line/startup/startup.factor b/basis/command-line/startup/startup.factor index cb005283a6..55ea43fbf7 100644 --- a/basis/command-line/startup/startup.factor +++ b/basis/command-line/startup/startup.factor @@ -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= load Factor image file [" 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= a list of \"" write os windows? ";" ":" ? write "\"-delimited extra vocab roots + -roots= '" 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 ; diff --git a/extra/mason/test/test.factor b/extra/mason/test/test.factor index 43b2ccf558..ea79090eef 100644 --- a/extra/mason/test/test.factor +++ b/extra/mason/test/test.factor @@ -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 ( -- ? )