Updates the gopher example file

sloum 2 years ago
parent 93fa32b692
commit 4ba9ee767d

@ -2,7 +2,7 @@
;;; slope gopher client
;;; This example is built to a fairly early version of slope and
;;; may not use all current capabilities of the system
(define version 4)
(define version 5)
(define default-port "70")
(define default-scheme "gopher://")
(define text-prompt "\033[1m$\033[0m ")
@ -16,10 +16,11 @@
(define get-input (lambda ()
;; Will return either a url parse list or #f
(define in (query-user text-prompt))
(define in (string-trim-space (query-user text-prompt)))
(define link-num (string->number in))
((equal? in "exit") (exit))
((or (equal? in "help") (equal? in "?")) (print-help))
((equal? in "forward")
(if (not (null? forward))
(begin0 (car forward) (set! forward (cdr forward)))
@ -227,8 +228,8 @@
(define print-line (lambda (line-split)
(define link-num (length current-page-links))
(if (equal? (get-line-type line-split) "i")
(display (string-format " \t%v\n" (get-line-text line-split)))
(display (string-format "[%-2v]\t%v\n" link-num (get-line-text line-split)))
(display (string-format " %v\n" (get-line-text line-split)))
(display (string-format "[\033[1;36m%-3v\033[0m] %v\n" link-num (get-line-text line-split)))
@ -240,10 +241,15 @@
((lambda ()
(define print-help (lambda ()
"\033[1mslope gopher client v0." version
"\033[0m\nCommands:\n\t'back', 'forward', 'exit', a URL (ex. 'sdf.org'), a link number (ex. '3')\n\n"
"\n\033[1;32;4mCommands:\033[24m\n \033[32m'back', 'forward', 'exit',\n 'help', '?',\n a URL (ex. 'sdf.org'),\n a link number (ex. '3')\033[0m\n\n")
((lambda ()
(display "\033[36;1mslope gopher client v0." version "\033[0m\n")
(if (> (length sys-args) 1) (make-request (parse-url (car (cdr sys-args)))))