Use parley.
This commit is contained in:
@@ -3,4 +3,4 @@
|
|||||||
((egg "hiss.egg")
|
((egg "hiss.egg")
|
||||||
(synopsis "hiss is a chicken scheme shell.")
|
(synopsis "hiss is a chicken scheme shell.")
|
||||||
(license "BSD")
|
(license "BSD")
|
||||||
(depends readline))
|
(depends parley apropos scsh-process))
|
||||||
|
|||||||
29
hiss.scm
29
hiss.scm
@@ -1,25 +1,5 @@
|
|||||||
(import chicken scheme)
|
(import chicken scheme)
|
||||||
(use parley parley-auto-completion srfi-1 apropos posix chicken-syntax)
|
(use parley parley-auto-completion srfi-1 apropos posix chicken-syntax scsh-process)
|
||||||
|
|
||||||
(set-read-syntax!
|
|
||||||
#\[
|
|
||||||
(lambda (port)
|
|
||||||
(letrec ((read-cmd (lambda (exps)
|
|
||||||
(let ((c (peek-char port)))
|
|
||||||
(cond ((eof-object? c)
|
|
||||||
(error "EOF encountered while parsing [ ... ] clause"))
|
|
||||||
((char=? c #\])
|
|
||||||
(read-char port)
|
|
||||||
exps)
|
|
||||||
((or (char=? c #\') (char=? c #\())
|
|
||||||
(read-cmd (cons (read port) exps)))
|
|
||||||
(else
|
|
||||||
(read-char port)
|
|
||||||
(read-cmd (cons (->string c) exps))))))))
|
|
||||||
`(lambda ()
|
|
||||||
(let ((result (with-input-from-pipe (string-append ,@(reverse (read-cmd '()))) read-lines)))
|
|
||||||
(for-each (cut print <>) result)
|
|
||||||
(values #t result))))))
|
|
||||||
|
|
||||||
; match (foo or foo
|
; match (foo or foo
|
||||||
(word-class '($ (: (& (~ (or "(" "[")) (~ whitespace)) (+ (~ whitespace)))))
|
(word-class '($ (: (& (~ (or "(" "[")) (~ whitespace)) (+ (~ whitespace)))))
|
||||||
@@ -63,8 +43,6 @@
|
|||||||
|
|
||||||
(define config-file
|
(define config-file
|
||||||
(make-parameter (string-append (or (get-environment-variable "HOME") ".") "/.hiss")))
|
(make-parameter (string-append (or (get-environment-variable "HOME") ".") "/.hiss")))
|
||||||
(when (file-exists? (config-file))
|
|
||||||
(load (config-file)))
|
|
||||||
|
|
||||||
(define (shell-repl)
|
(define (shell-repl)
|
||||||
(if (exit?)
|
(if (exit?)
|
||||||
@@ -78,4 +56,7 @@
|
|||||||
(newline)
|
(newline)
|
||||||
(shell-repl))))
|
(shell-repl))))
|
||||||
|
|
||||||
(shell-repl)
|
(begin
|
||||||
|
(when (file-exists? (config-file))
|
||||||
|
(load (config-file)))
|
||||||
|
(shell-repl))
|
||||||
|
|||||||
@@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
(install-program 'hiss
|
(install-program 'hiss
|
||||||
'("hiss")
|
'("hiss")
|
||||||
`((version "2")))
|
`((version "0.0.1")))
|
||||||
|
|||||||
Reference in New Issue
Block a user