]> gitweb.factorcode.org Git - factor.git/commitdiff
tools.copy: adding "copy" tool.
authorJohn Benediktsson <mrjbq7@gmail.com>
Wed, 1 Apr 2015 21:30:49 +0000 (14:30 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Wed, 1 Apr 2015 21:30:49 +0000 (14:30 -0700)
extra/tools/copy/authors.txt [new file with mode: 0644]
extra/tools/copy/copy.factor [new file with mode: 0644]
extra/tools/copy/deploy.factor [new file with mode: 0644]

diff --git a/extra/tools/copy/authors.txt b/extra/tools/copy/authors.txt
new file mode 100644 (file)
index 0000000..e091bb8
--- /dev/null
@@ -0,0 +1 @@
+John Benediktsson
diff --git a/extra/tools/copy/copy.factor b/extra/tools/copy/copy.factor
new file mode 100644 (file)
index 0000000..cf2dbd8
--- /dev/null
@@ -0,0 +1,28 @@
+! Copyright (C) 2011 John Benediktsson
+! See http://factorcode.org/license.txt for BSD license
+
+USING: combinators combinators.short-circuit command-line io
+io.directories io.files io.files.info kernel math namespaces
+sequences ;
+
+IN: tools.copy
+
+: usage ( -- )
+    "Usage: copy source ... target" print ;
+
+: copy-to-dir ( args -- )
+    dup last file-info directory?
+    [ unclip-last copy-files-into ] [ drop usage ] if ;
+
+: copy-to-file ( args -- )
+    dup last { [ exists? ] [ file-info directory? ] } 1&&
+    [ copy-to-dir ] [ first2 copy-file ] if ;
+
+: run-copy ( -- )
+    command-line get dup length {
+        { [ dup 2 > ] [ drop copy-to-dir  ] }
+        { [ dup 2 = ] [ drop copy-to-file ] }
+        [ 2drop usage ]
+    } cond ;
+
+MAIN: run-copy
diff --git a/extra/tools/copy/deploy.factor b/extra/tools/copy/deploy.factor
new file mode 100644 (file)
index 0000000..b55c6fb
--- /dev/null
@@ -0,0 +1,15 @@
+USING: tools.deploy.config ;
+H{
+    { deploy-name "copy" }
+    { deploy-ui? f }
+    { deploy-c-types? f }
+    { deploy-console? t }
+    { deploy-unicode? f }
+    { "stop-after-last-window?" t }
+    { deploy-io 3 }
+    { deploy-reflection 6 }
+    { deploy-word-props? f }
+    { deploy-math? t }
+    { deploy-threads? t }
+    { deploy-word-defs? f }
+}