28 lines
871 B
Scheme
28 lines
871 B
Scheme
|
(define command-prefix #\,)
|
||
|
|
||
|
(define (split-scheme-command-line command-line)
|
||
|
(let ((tokens (string-tokenize command-line)))
|
||
|
(values (string->symbol (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 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")
|
||
|
(else (error "unknwon scheme command"))))
|