#!/bin/sh
#|-*- mode:lisp -*-|#
#|Mercurial wrapper
exec ros -Q -m roswell -N roswell -- $0 "$@"
|#
(progn ;;init forms
  (ros:ensure-asdf)
  (roswell:include "util"))

(defpackage :ros.script.hg.3707457708
  (:use :cl :roswell.util))
(in-package :ros.script.hg.3707457708)

(defun main (&rest argv)
  (let* ((name (pathname-name *load-pathname*)))
    (roswell:exec
     (cond
       ((equal (first argv) "clone")
        (uiop:chdir (first roswell:*local-project-directories*))
        `(,name ,@argv))
       ((ql:where-is-system (first argv))
        (let* ((path (make-pathname
                      :type nil :name nil
                      :defaults (ql:where-is-system (first argv)))))
          (if (ignore-errors (uiop:chdir path))
              `(,name ,@(rest argv))
              (progn
                (format t "~A not found.~%" (first argv))
                (roswell:quit 1)))))
       (t `(,(roswell:opt "wargv0") "help" ,name))))))
;;; vim: set ft=lisp lisp:
