1 ! Copyright (C) 2003, 2007 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: init continuations debugger hashtables io kernel
4 kernel.private namespaces parser sequences strings system
8 : run-bootstrap-init ( -- )
10 home ".factor-boot-rc" append-path ?run-file
13 : run-user-init ( -- )
15 home ".factor-rc" append-path ?run-file
18 : cli-var-param ( name value -- ) swap set-global ;
20 : cli-bool-param ( name -- ) "no-" ?head not cli-var-param ;
22 : cli-param ( param -- )
23 "=" split1 [ cli-var-param ] [ cli-bool-param ] if* ;
25 : cli-arg ( argument -- argument )
26 "-" ?head [ cli-param f ] when ;
28 : cli-args ( -- args ) 10 getenv ;
30 SYMBOL: main-vocab-hook
32 : main-vocab ( -- vocab )
34 "alien.remote-control"
36 main-vocab-hook get [ call ] [ "listener" ] if*
39 : default-cli-args ( -- )
49 : ignore-cli-args? ( -- ? )
50 os macosx? "run" get "ui" = and ;
54 "none" "run" set-global ;
56 : parse-command-line ( -- )
57 cli-args [ cli-arg ] filter
58 "script" get [ script-mode ] when
59 ignore-cli-args? [ drop ] [ [ run-file ] each ] if
60 "e" get [ eval ] when* ;
62 [ default-cli-args ] "command-line" add-init-hook