]> gitweb.factorcode.org Git - factor.git/blob - basis/command-line/startup/startup.factor
Make "quiet" true by default. Disable quiet mode for listener, bootstrap, and deploy...
[factor.git] / basis / command-line / startup / startup.factor
1 ! Copyright (C) 2011 Joe Groff.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: command-line eval io io.pathnames kernel namespaces
4 system vocabs.loader ;
5 IN: command-line.startup
6
7 : cli-usage ( -- )
8 """
9 Usage: """ write vm file-name write """ [Factor arguments] [script] [script arguments]
10
11 Common arguments:
12     -help            print this message and exit
13     -i=<image>       load Factor image file <image> (default """ write vm file-name write """.image)
14     -run=<vocab>     run the MAIN: entry point of <vocab>
15     -e=<code>        evaluate <code>
16     -no-user-init    suppress loading of .factor-rc
17
18 Enter
19     "command-line" help
20 from within Factor for more information.
21
22 """ write ;
23
24 : command-line-startup ( -- )
25     (command-line) parse-command-line
26     "help" get "-help" get or "h" get or [ cli-usage ] [
27         load-vocab-roots
28         run-user-init
29     
30         "e" get script get or [
31             "e" get [ eval( -- ) ] when*
32             script get [ run-script ] when*
33         ] [
34             "run" get run
35         ] if
36     ] if
37
38     output-stream get [ stream-flush ] when*
39     0 exit ;
40