(define command-prefix #\,) (define (split-scheme-command-line command-line) (let ((tokens (string-tokenize command-line))) (values (string-drop (car tokens) 1) (cdr tokens)))) (define (scheme-command-line? command-line) (char=? (string-ref (string-trim command-line) 0) command-prefix)) (define (eval-scheme-command command args) (case (string->symbol command) ((in) (set-evaluation-package! (string->symbol (car args))) (string-append "moved to package " (car args))) ((open) (package-open! (evaluation-environment) (lambda () (environment-ref (config-package) (string->symbol (car args))))) (string-append "opened package " (car args))) ((user) (set-evaluation-package! 'nuit-eval) "moved to package nuit-eval") ((inspect) (if (null? args) ",inspect requires an argument" (make-inspection-object (eval-string (string-join args))))) ((exit) (exit)) (else (error "unknwon scheme command" command))))