#!/usr/bin/env chicken-scheme ;; -*- mode: scheme; -*- (import scheme) (import (chicken base)) (import (chicken file)) (import (chicken format)) (import (chicken pathname)) (import (chicken process-context)) (import (chicken time posix)) (import hyde) (let* ((title (list-ref (argv) 1)) (date (time->string (seconds->local-time) "%Y-%m-%d %H:%M:%S %z")) (path (make-pathname (format "~a/posts/" (source-dir)) (pathify title) ".rst"))) (if (file-exists? path) (begin (display "File already exists\n" (current-error-port)) (exit 1)) (begin (print path) (with-output-to-file path (lambda () (display (format "((title . ~s)\n (date . ~s))\n\n" title date)))))))