coleslaw/cli/launch/clean.lisp
Javier Olaechea 6ab3081beb Preliminary CLI work
* src/cli.lisp: utility functions for CLI processing.
  * cli/launch/build.lisp: Builds the blog/site
  * cli/launch/clean.lisp: Deletes the staging and deploy dir
  * cli/launch/rebuild.lisp: Same as clean and build.
  * cli/launch/serve.lisp: Doesn't work.
  * src/config.lisp: load-config now takes the path to the config file
    as an argument instead of trying to discover it itself.
2015-06-23 19:03:17 -05:00

17 lines
755 B
Common Lisp
Executable file

#!/usr/bin/cl -Q -sp coleslaw --entry clean
;; clean files of deploy-dir and staging-dir
(defun clean (argv)
(let* ((parameters (coleslaw-cli:process-parameters argv))
(current-dir (uiop/os:getcwd))
(repo-dir (or (cdr (assoc :repo-dir parameters))
current-dir))
(config-file (or (cdr (assoc :config parameters))
(discover-config-path current-dir))))
(load-config config-file repo-dir)
(dolist (dir (list (staging-dir *config*)
(deploy-dir *config*)))
(uiop/filesystem:delete-directory-tree (pathname dir)
:if-does-not-exist :ignore
:validate t))))