]> gitweb.factorcode.org Git - factor.git/blob - extra/tools/echo/echo.factor
0fcf9db16bba11d85b2416c96f0d28716d12affd
[factor.git] / extra / tools / echo / echo.factor
1 ! Copyright (C) 2011 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3
4 USING: command-line io kernel namespaces sequences ;
5
6 IN: tools.echo
7
8 : -n? ( args -- ? args' )
9     [ first "-n" = ] keep over [ rest ] when ;
10
11 : echo-args ( args -- )
12     -n? " " join write [ nl ] unless ;
13
14 : run-echo ( -- )
15     command-line get [ nl ] [ echo-args ] if-empty ;
16
17 MAIN: run-echo