Help text

This commit is contained in:
Tony Garnock-Jones 2011-10-31 10:55:19 -04:00
parent bfc86ec58d
commit 89e96b0ccb
1 changed files with 9 additions and 0 deletions

View File

@ -80,6 +80,13 @@
(hash-set! *environments* username (make-base-namespace)))
(hash-ref *environments* username))
(define (help)
(printf "This is RacketSSH, a secure REPL for Racket.\n")
(printf "Definitions made are kept in a per-user environment.\n")
(printf "Beyond core Racket,\n")
(printf " (say <any>) - communicates its argument to other logged-in users\n")
(printf " (help) - this help message\n"))
(define (repl-shell username in out)
(define handle (join-room *interaction* username))
(define env (get-user-environment username))
@ -93,7 +100,9 @@
(sandbox-namespace-specs (list (lambda () env))))
(parameterize ((current-eval (make-evaluator '(begin))))
(printf "Hello, ~a.\n" username)
(printf "Type (help) for help.\n")
(eval `(,*interaction-handle* ,handle))
(eval `(define help ,help))
(eval `(define say ,(lambda (utterance)
(printf " You: ~a\n" (->string/safe utterance))
(send (*interaction-handle*) say utterance)