tools.copy: adding "copy" tool.
parent
2e56aebcb2
commit
24bd7c098f
|
@ -0,0 +1 @@
|
||||||
|
John Benediktsson
|
|
@ -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
|
|
@ -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 }
|
||||||
|
}
|
Loading…
Reference in New Issue