Index: megatest.scm ================================================================== --- megatest.scm +++ megatest.scm @@ -572,17 +572,17 @@ (process:children #f)) (original-exit exit-code))))) ;; for some switches always print the command to stderr ;; -(if (args:any? "-run" "-runall" "-remove-runs" "-set-state-status") +(if (args:any-defined? "-run" "-runall" "-remove-runs" "-set-state-status") (debug:print 0 *default-log-port* (string-intersperse (argv) " "))) ;; some switches imply homehost. Exit here if not on homehost ;; (let ((homehost-required (list "-cleanup-db" "-server"))) - (if (apply args:any? homehost-required) + (if (apply args:any-defined? homehost-required) (if (not (common:on-homehost?)) (for-each (lambda (switch) (if (args:get-arg switch) (begin Index: modules.scm ================================================================== --- modules.scm +++ modules.scm @@ -16,15 +16,27 @@ ;; You should have received a copy of the GNU General Public License ;; along with Megatest. If not, see . ;;====================================================================== (use (prefix mtargs args:)) -(use (prefix mtdebug debug:)) +(use mtdebug) (use (prefix mtconfigf configf:)) -(print "BB> called once") -(configf:add-eval-string "(use (prefix mtargs args:)) - (use (prefix mtdebug debug:)) - (use (prefix mtconfigf configf:))") +;; configure mtdebug ;; TODO: move to megatest.scm with other command line arg processing +(if (args:get-arg "-v") (debug:set-verbose-mode)) +(if (args:get-arg "-q") (debug:set-quiet-mode)) +(if (args:get-arg "-debug") (debug:set-debug-mode)) +(if (args:get-arg "-color") + (case (string->symbol (args:get-arg "-color")) + ((y Y yes YES t T) (debug:force-color)) + ((n N no NO f F) (debug:suppress-color)))) + +;; configure mtconfigf +(let* ((normal-fn debug:print) + (info-fn debug:print-info) + (error-fn debug:print-error) + (default-port *default-log-port*)) + (set-debug-printers normal-fn info-fn error-fn default-port)) - - +(configf:add-eval-string "(use (prefix mtargs args:)) + (use mtdebug) + (use (prefix mtconfigf configf:))") Index: mtut.scm ================================================================== --- mtut.scm +++ mtut.scm @@ -475,11 +475,11 @@ (member *action* '("db" "tsend" "tlisten")) ;; very loose checks on db and tsend/listen (equal? *action* "show") ;; just keep going if list ))) (debug:print-error 0 *default-log-port* "Unrecognised arguments: " (string-intersperse (if (list? remargs) remargs (argv)) " "))) -(if (or (args:any? "-h" "help" "-help" "--help") +(if (or (args:any-defined? "-h" "help" "-help" "--help") (member *action* '("-h" "-help" "--help" "help"))) (begin (print help) (exit 1)))