(module test-fcp * (import scheme chicken.base chicken.process-context chicken.string chicken.file chicken.process chicken.pathname chicken.pretty-print matchable regex fcp) (match (command-line-arguments) (("retrieve" src-uri destfile) (let* ((dir (pathname-directory destfile)) (fname (pathname-strip-directory destfile))) (if (file-exists? destfile) (begin (print "ERROR: Destination file /tmp/"fname" exists, please remove it/") (exit))) ;; (system (conc "rm "destfile))) (retrieve-file src-uri dir fname))) (("insert" destfile) (if (not (file-exists? destfile)) (print "ERROR: "destfile" does not exist.") (let* ((dir (pathname-directory destfile)) (fname (pathname-strip-directory destfile))) (print (insert-file dir fname))))) (("genssk") (pp (gen-ssk))) (("insert" destfile ssk) (if (not (file-exists? destfile)) (print "ERROR: "destfile" does not exist.") (let* ((dir (pathname-directory destfile)) (fname (pathname-strip-directory destfile))) (print (insert-file dir fname ssk))))) (else (print "Usage: fcpapp cmd [options] retrieve URI destpath/file : get a file insert path/file : insert file insert path/file SSK : insert file using SSK genssk : create an SSK"))) )