tools.cat: adding "cat" tool.

db4
John Benediktsson 2015-04-01 14:26:22 -07:00
parent be1a8d085d
commit 2e56aebcb2
3 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1 @@
John Benediktsson

View File

@ -0,0 +1,27 @@
! Copyright (C) 2010 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: command-line formatting kernel io io.encodings.binary
io.files namespaces sequences strings ;
IN: tools.cat
: cat-lines ( -- )
[ print flush ] each-line ;
: cat-stream ( -- )
[ >string write flush ] each-block ;
: cat-file ( path -- )
dup exists? [
binary [ cat-stream ] with-file-reader
] [ "%s: not found\n" printf flush ] if ;
: cat-files ( paths -- )
[ dup "-" = [ drop cat-lines ] [ cat-file ] if ] each ;
: run-cat ( -- )
command-line get [ cat-lines ] [ cat-files ] if-empty ;
MAIN: run-cat

View File

@ -0,0 +1,16 @@
USING: tools.deploy.config ;
H{
{ deploy-c-types? f }
{ deploy-help? f }
{ deploy-name "cat" }
{ "stop-after-last-window?" t }
{ deploy-unicode? f }
{ deploy-console? t }
{ deploy-io 3 }
{ deploy-reflection 1 }
{ deploy-ui? f }
{ deploy-word-defs? f }
{ deploy-threads? t }
{ deploy-math? t }
{ deploy-word-props? f }
}