]> gitweb.factorcode.org Git - factor.git/commitdiff
command-line: move some stuff to command-line.startup so that deployed images don...
authorSlava Pestov <slava@factorcode.org>
Fri, 2 Sep 2011 03:32:33 +0000 (20:32 -0700)
committerSlava Pestov <slava@factorcode.org>
Fri, 2 Sep 2011 05:31:44 +0000 (22:31 -0700)
basis/bootstrap/finish-bootstrap.factor
basis/command-line/command-line.factor
basis/command-line/startup/authors.txt [new file with mode: 0644]
basis/command-line/startup/startup.factor [new file with mode: 0644]

index b64de97622ea720a5a77a3135a84ca2c85f5c44b..8d6e23c48597fe233c4014cb54e80cafbb4879e2 100644 (file)
@@ -1,5 +1,4 @@
-USING: init command-line debugger system continuations
-namespaces eval kernel vocabs.loader io ;
+USING: init command-line.startup debugger system continuations ;
 
 [
     boot
index 0b55798b2d4fb8e0a63822506e0d3114e478d11c..e902bbc396f3cb2d9b7a3d9e66f147055f98f2a4 100644 (file)
@@ -3,7 +3,7 @@
 USING: init continuations hashtables io io.encodings.utf8
 io.files io.pathnames kernel kernel.private namespaces parser
 sequences source-files strings system splitting vocabs.loader
-alien.strings accessors eval ;
+alien.strings accessors ;
 IN: command-line
 
 SYMBOL: script
@@ -71,41 +71,3 @@ SYMBOL: main-vocab-hook
     ] bind ;
 
 [ default-cli-args ] "command-line" add-startup-hook
-
-: cli-usage ( -- )
-"""
-Usage: """ write vm file-name write """ [Factor arguments] [script] [script arguments]
-
-Common arguments:
-    -help            print this message and exit
-    -i=<image>       load Factor image file <image> (default """ write vm file-name write """.image)
-    -run=<vocab>     run the MAIN: entry point of <vocab>
-    -e=<code>        evaluate <code>
-    -quiet           suppress "Loading vocab.factor" messages
-    -no-user-init    suppress loading of .factor-rc
-
-Enter
-    "command-line" help
-from within Factor for more information.
-
-""" write ;
-
-: command-line-startup ( -- )
-    (command-line) parse-command-line
-    "help" get "-help" get or "h" get or [ cli-usage ] [
-        "e" get script get or "quiet" [
-            load-vocab-roots
-            run-user-init
-
-            "e" get script get or [
-                "e" get [ eval( -- ) ] when*
-                script get [ run-script ] when*
-            ] [
-                "run" get run
-            ] if
-        ] with-variable
-    ] if
-
-    output-stream get [ stream-flush ] when*
-    0 exit ;
-
diff --git a/basis/command-line/startup/authors.txt b/basis/command-line/startup/authors.txt
new file mode 100644 (file)
index 0000000..1901f27
--- /dev/null
@@ -0,0 +1 @@
+Slava Pestov
diff --git a/basis/command-line/startup/startup.factor b/basis/command-line/startup/startup.factor
new file mode 100644 (file)
index 0000000..1edf169
--- /dev/null
@@ -0,0 +1,43 @@
+! Copyright (C) 2011 Joe Groff.
+! See http://factorcode.org/license.txt for BSD license.
+USING: command-line eval io io.pathnames kernel namespaces
+system vocabs.loader ;
+IN: command-line.startup
+
+: cli-usage ( -- )
+"""
+Usage: """ write vm file-name write """ [Factor arguments] [script] [script arguments]
+
+Common arguments:
+    -help            print this message and exit
+    -i=<image>       load Factor image file <image> (default """ write vm file-name write """.image)
+    -run=<vocab>     run the MAIN: entry point of <vocab>
+    -e=<code>        evaluate <code>
+    -quiet           suppress "Loading vocab.factor" messages
+    -no-user-init    suppress loading of .factor-rc
+
+Enter
+    "command-line" help
+from within Factor for more information.
+
+""" write ;
+
+: command-line-startup ( -- )
+    (command-line) parse-command-line
+    "help" get "-help" get or "h" get or [ cli-usage ] [
+        "e" get script get or "quiet" [
+            load-vocab-roots
+            run-user-init
+
+            "e" get script get or [
+                "e" get [ eval( -- ) ] when*
+                script get [ run-script ] when*
+            ] [
+                "run" get run
+            ] if
+        ] with-variable
+    ] if
+
+    output-stream get [ stream-flush ] when*
+    0 exit ;
+