diff --git a/gash/gash.scm b/gash/gash.scm index 89b4197..9f2567f 100644 --- a/gash/gash.scm +++ b/gash/gash.scm @@ -40,17 +40,13 @@ #:use-module (gash parser) #:use-module (gash repl) - #:export (main - %debug-level - %prefer-builtins?)) + #:export (main)) (catch #t (lambda _ (use-modules (ice-9 readline))) (lambda (key . args) (use-modules (gash readline)))) -(define %debug-level 0) ; 1 informational, 2 verbose, 3 peg tracing -(define %prefer-builtins? #f) ; use builtin, even if COMMAND is available in PATH? (define (display-help) (display (string-append "\ Usage: gash [OPTION]... [FILE]... @@ -59,10 +55,8 @@ Usage: gash [OPTION]... [FILE]... Options: -c, --command=STRING Evaluate STRING and exit -e, --errexit Exit upon error - -d, --debug Verbose debug output -h, --help Display this help -p, --parse Parse the shell script and print the parse tree - --prefer-builtins Use builtins, even if command is available in PATH -v, --version Display the version -x, --xtrace Print simple command trace "))) @@ -84,28 +78,21 @@ copyleft. (let ((thunk (lambda () (let* ((option-spec '((command (single-char #\c) (value #t)) - (debug (single-char #\d)) (errexit (single-char #\e)) (help (single-char #\h)) (parse (single-char #\p)) - (prefer-builtins) (version (single-char #\v)) (xtrace (single-char #\x)))) (args (take-while (negate (cut equal? <> "--")) args)) (options (getopt-long args option-spec #:stop-at-first-non-option #t)) (command (option-ref options 'command #f)) (opt? (lambda (name) (lambda (o) (and (eq? (car o) name) (cdr o))))) - (debug (length (filter-map (opt? 'debug) options))) - (debug? (option-ref options 'debug #f)) (help? (option-ref options 'help #f)) (parse? (option-ref options 'parse #f)) (version? (option-ref options 'version #f)) (files (option-ref options '() '()))) - (set! %prefer-builtins? (option-ref options 'prefer-builtins #f)) (setopt! 'errexit (option-ref options 'errexit #f)) (setopt! 'xtrace (option-ref options 'xtrace #f)) - (when (option-ref options 'debug #f) - (set! %debug-level debug)) (cond (help? (display-help)) (version? (display-version))