[Cl-darcs-cvs] r148 - cl-darcs/trunk
mhenoch at common-lisp.net
mhenoch at common-lisp.net
Sun Nov 25 21:11:09 UTC 2007
Author: mhenoch
Date: Sun Nov 25 16:11:09 2007
New Revision: 148
Modified:
cl-darcs/trunk/cl-darcs.asd
cl-darcs/trunk/cmdline.lisp
Log:
Use getopt library. Use it for "init" command.
Modified: cl-darcs/trunk/cl-darcs.asd
==============================================================================
--- cl-darcs/trunk/cl-darcs.asd (original)
+++ cl-darcs/trunk/cl-darcs.asd Sun Nov 25 16:11:09 2007
@@ -22,7 +22,8 @@
;; Regexps
:cl-ppcre
;; Diff
- :cl-difflib)
+ :cl-difflib
+ :getopt)
:components
((:file "packages")
Modified: cl-darcs/trunk/cmdline.lisp
==============================================================================
--- cl-darcs/trunk/cmdline.lisp (original)
+++ cl-darcs/trunk/cmdline.lisp Sun Nov 25 16:11:09 2007
@@ -90,6 +90,20 @@
Usage: darcs whatsnew"
(diff-repo-display (find-repo)))
-(define-darcs-command init ()
- "Initialize a darcs repository in the current directory."
- (create-repo (truename *default-pathname-defaults*)))
+(define-darcs-command init (&rest args)
+ "Initialize a darcs repository in the current directory.
+
+Options:
+--repodir=DIRECTORY Use DIRECTORY instead of current directory"
+ (multiple-value-bind (operands options errors)
+ (getopt:getopt args
+ '(("repodir" :required)))
+ (declare (ignore operands))
+ (if errors
+ (progn
+ (format *error-output* "Invalid arguments: ~{ ~A ~}~%" errors)
+ 1)
+ (let ((repodir (or (cdr (assoc "repodir" options :test #'string=))
+ *default-pathname-defaults*)))
+ (format t "Creating repo in ~S...~%" repodir)
+ (create-repo (truename repodir))))))
More information about the Cl-darcs-cvs
mailing list