From 24bd7c098f530e9d647f6cceeb597c41550f3029 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 1 Apr 2015 14:30:49 -0700 Subject: [PATCH] tools.copy: adding "copy" tool. --- extra/tools/copy/authors.txt | 1 + extra/tools/copy/copy.factor | 28 ++++++++++++++++++++++++++++ extra/tools/copy/deploy.factor | 15 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 extra/tools/copy/authors.txt create mode 100644 extra/tools/copy/copy.factor create mode 100644 extra/tools/copy/deploy.factor diff --git a/extra/tools/copy/authors.txt b/extra/tools/copy/authors.txt new file mode 100644 index 0000000000..e091bb8164 --- /dev/null +++ b/extra/tools/copy/authors.txt @@ -0,0 +1 @@ +John Benediktsson diff --git a/extra/tools/copy/copy.factor b/extra/tools/copy/copy.factor new file mode 100644 index 0000000000..cf2dbd853a --- /dev/null +++ b/extra/tools/copy/copy.factor @@ -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 index 0000000000..b55c6fbdaf --- /dev/null +++ b/extra/tools/copy/deploy.factor @@ -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 } +} -- 2.34.1