From 4b016383d2699ab14301513229443b04822c1d61 Mon Sep 17 00:00:00 2001 From: Bert Burgemeister Date: Fri, 15 Jun 2012 16:49:04 +0200 Subject: [PATCH] Refactor internal packages --- cli.lisp | 458 +++++++++++++++++++++++++++++++---------------------------- package.lisp | 126 ++++++++-------- phoros.lisp | 22 --- util.lisp | 61 +++++--- 4 files changed, 346 insertions(+), 321 deletions(-) diff --git a/cli.lisp b/cli.lisp index 720b6de..61638da 100644 --- a/cli.lisp +++ b/cli.lisp @@ -18,11 +18,33 @@ ;;;; The UNIX command line interface -(in-package :phoros) +(in-package :cli) + +(defparameter *phoros-description* + (asdf:system-description (asdf:find-system :phoros)) + "Phoros description as defined in system definition.") + +(defparameter *phoros-long-description* + (substitute #\Space #\Newline + (asdf:system-long-description (asdf:find-system :phoros))) + "Phoros long-description as defined in system definition.") + +(defparameter *phoros-licence* + (asdf:system-licence (asdf:find-system :phoros)) + "Phoros licence as defined in system definition.") + +(defvar *verbosity* nil + "List of strings like \"topic:7\".") + +(defvar *umask* "002" + "String containing octal representation of Phoros' umask") + +(defvar *unix-exit-code* 0 + "UNIX exit code.") (let (serial-number description try-overwrite device-stage-of-life-id c common-root bayer-pattern unmounting-date) - (cli:defsynopsis () + (defsynopsis () (text :contents *phoros-long-description*) (text :contents @@ -171,7 +193,7 @@ ;; The way it should be had we two-dimensional arrays in postmodern: ;;("bayer-pattern" :type string :list t :optional t :action :raw-bayer-pattern :description "The first pixels of the first row. Repeat this option to describe following row(s). Each pixel is to be interpreted as RGB hex string. Example: use #ff0000,#00ff00 if the first pixels in topmost row are red, green.") (setf bayer-pattern - (cli:make-stropt + (make-stropt :long-name "bayer-pattern" :default-value "#ff0000,#00ff00" :description "The first pixels of the first row. Each pixel is to be interpreted as RGB hex string. Example: use #ff0000,#00ff00 if the first pixels in topmost row are red, green.")))) @@ -206,17 +228,17 @@ ;;("bayer-pattern" :type string :list t :optional t :action :raw-bayer-pattern :description "The first pixels of the first row. Repeat this option to describe following row(s). Each pixel is to be interpreted as RGB hex string. Example: use #ff0000,#00ff00 if the first pixels in topmost row are red, green.") bayer-pattern (setf serial-number - (cli:make-stropt + (make-stropt :long-name "serial-number" :default-value " " :description "Serial number.")) (setf description - (cli:make-stropt + (make-stropt :long-name "description" :default-value " " :description "Description of camera.")) (setf try-overwrite - (cli:make-switch + (make-switch :long-name "try-overwrite" :default-value t :argument-type :required @@ -228,7 +250,7 @@ :description "Put new lens data into the database; print lens-id to stdout.") (group () (setf c - (cli:make-lispobj + (make-lispobj :long-name "c" :typespec 'real :argument-name "NUM" :description "Focal length.")) @@ -281,7 +303,7 @@ (stropt :long-name "mounting-date" :description "Time this device constellation became effective. Format: \"2010-11-19T13:49+01\".") (setf unmounting-date - (cli:make-stropt + (make-stropt :long-name "unmounting-date" :default-value ":null" :description "Time this device constellation ceased to be effective. Format: \"2010-11-19T17:02+01\".")))) @@ -292,7 +314,7 @@ :description "Put an end date to a device-stage-of-life in the database; print device-stage-of-life-id to stdout.") (group () (setf device-stage-of-life-id - (cli:make-lispobj + (make-lispobj :long-name "device-stage-of-life-id" :typespec 'integer :argument-name "ID" :description "ID of the device-stage-of-life.")) @@ -452,7 +474,7 @@ :type :directory :description "Directory containing one set of measuring data.") (setf common-root - (cli:make-path + (make-path :long-name "common-root" :short-name "r" :env-var "PHOROS_COMMON_ROOT" :type :directory @@ -624,20 +646,20 @@ :fallback-value "*" :description "List the specified user with their presentation projects, or all users if no user is given.")))) -(defun cli:first-action-option (&rest options) +(defun first-action-option (&rest options) "Run action called