New reload command and we can end at anytime properly - clic - Clic is an command line interactive client for gopher written in Common LISP HTML git clone git://bitreich.org/clic/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/clic/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit fdffd2e4d1c02050fcf6f441b6e0029d560c1449 DIR parent 8ac8cdfbdce8d9159b195f1d1a15d9988033f29f HTML Author: Solene Rapenne <solene@perso.pw> Date: Thu, 16 Nov 2017 12:10:40 +0000 New reload command and we can end at anytime properly Diffstat: M clic.lisp | 54 +++++++++++++++++++++---------- M make-binary.lisp | 6 +++--- 2 files changed, 40 insertions(+), 20 deletions(-) --- DIR diff --git a/clic.lisp b/clic.lisp @@ -235,6 +235,12 @@ (pop *history*) (visit (pop *history*)))) +(defun r() + "browse to the previous link" + (when (<= 1 (length *history*)) + (visit (pop *history*)))) + + (defun load-bookmark() "Restore the bookmark from file" (when (probe-file *bookmark-file*) @@ -324,28 +330,37 @@ (defun user-input(input) (cond ;; show help - ((string= "HELP" input) + ((string= "help" input) (help-shell)) ;; bookmark current link - ((string= "A" input) + ((string= "a" input) (add-bookmark)) ;; show bookmarks - ((string= "B" input) + ((string= "b" input) (show-bookmarks)) + ((or + (string= "ls" input) + (string= "r" input)) + (r)) + ;; go to previous page - ((string= "P" input) + ((or + (string= "cd .." input) + (string= "p" input)) (p)) ;; exit - ((or (string= "X" input) - (string= "Q" input)) - (quit)) + ((or + (string= "exit" input) + (string= "x" input) + (string= "q" input)) + 'end) ;; show history - ((string= "H" input) + ((string= "h" input) (format t "~{~a~%~}" *history*)) ;; follow a link @@ -423,12 +438,14 @@ (force-output) ;; we loop until X or Q is typed - (loop for input = (format nil "~a" (read nil nil)) + (loop for input = (format nil "~a" (read-line nil nil)) while (not (or - (string= "X" input) - (string= "Q" input))) + (string= "exit" input) + (string= "x" input) + (string= "q" input))) do - (user-input input) + (when (eq 'end (user-input input)) + (loop-finish)) (format t "clic => ") (force-output))) @@ -439,11 +456,14 @@ (if argv ;; url as argument (parse-url argv) - ;; default url - (make-location :host "bitreich.org" :port 70 :uri "/" :type "1"))))) - (visit destination) - (when (string= "1" (location-type destination)) - (shell)))) + ;; default url + (make-location :host "bitreich.org" :port 70 :uri "/" :type "1"))))) + + ;; if user want to drop from first page we need + ;; to look it here + (when (not (eq 'end (visit destination))) + (when (string= "1" (location-type destination)) + (shell))))) ;; we allow ecl to use a new kind of argument ;; not sure how it works but that works DIR diff --git a/make-binary.lisp b/make-binary.lisp @@ -1,5 +1,5 @@ -;; ecl produces a linked binary -;; while sbcl produces a static binary (but huge ~ 10Mb) +;; ecl produces a linked binary to ecl shared library +;; sbcl produces a static binary (~ 10Mb with compression / 70Mb without) #+ecl (require 'cmp) @@ -24,5 +24,5 @@ :executable t :toplevel 'main)) -(format t "INFO => Compilation done (or at least it should)~%") +(format t "INFO => Compilation done (or at least it should be)~%") (quit)