tools.move: adding "move" tool.
parent
24bd7c098f
commit
54595382ff
|
@ -0,0 +1 @@
|
|||
John Benediktsson
|
|
@ -0,0 +1,15 @@
|
|||
USING: tools.deploy.config ;
|
||||
H{
|
||||
{ deploy-name "move" }
|
||||
{ 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 }
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
! Copyright (C) 2011 John Benediktsson
|
||||
! See http://factorcode.org/license.txt for BSD license
|
||||
|
||||
USING: combinators command-line io io.directories io.files.info
|
||||
kernel math namespaces sequences ;
|
||||
|
||||
IN: tools.move
|
||||
|
||||
! FIXME: better error messages when files don't exist
|
||||
|
||||
: usage ( -- )
|
||||
"Usage: move source ... target" print ;
|
||||
|
||||
: move-to-dir ( args -- )
|
||||
dup last file-info directory?
|
||||
[ unclip-last move-files-into ] [ drop usage ] if ;
|
||||
|
||||
: move-to-file ( args -- )
|
||||
dup last file-info directory?
|
||||
[ move-to-dir ] [ first2 move-file ] if ;
|
||||
|
||||
: run-move ( -- )
|
||||
command-line get dup length {
|
||||
{ [ dup 2 > ] [ drop move-to-dir ] }
|
||||
{ [ dup 2 = ] [ drop move-to-file ] }
|
||||
[ 2drop usage ]
|
||||
} cond ;
|
||||
|
||||
MAIN: run-move
|
Loading…
Reference in New Issue