1 ! Copyright (C) 2016 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3 USING: accessors calendar calendar.format combinators
4 command-line kernel math.parser namespaces sequences
8 : cal-args ( -- timestamp year? )
13 { "-m" [ rest ?first2 swap f ] }
14 { "-y" [ rest ?first2 dup [ swap ] when t ] }
15 [ drop ?first2 dup [ swap ] when dup not ]
19 [ [ >>month ] when* ] bi*
24 cal-args [ year. ] [ month. ] if ;