Structure 'echo' like all the other built-ins.

* gash/built-ins/echo.scm (echo): Rename this...
(main): ...to this, and do not export it.
* gash/built-ins.scm: Reference the 'main' function of the 'echo'
module using '@@'.
This commit is contained in:
Timothy Sample 2019-05-16 20:30:54 -04:00
parent 10400ed2ad
commit 5b236ceef3
2 changed files with 3 additions and 5 deletions

View File

@ -17,7 +17,6 @@
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
(define-module (gash built-ins)
#:use-module (gash built-ins echo)
#:export (search-built-ins
search-special-built-ins))
@ -72,7 +71,7 @@
("unalias" . ,undefined)
("wait" . ,undefined)
;; Other built-ins.
("echo" . ,echo)))
("echo" . ,(@@ (gash built-ins echo) main))))
(define (search-special-built-ins name)
(assoc-ref *special-built-ins* name))

View File

@ -20,8 +20,7 @@
(define-module (gash built-ins echo)
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (echo))
#:use-module (srfi srfi-26))
;;; Commentary:
;;;
@ -57,7 +56,7 @@
(char=? (string-ref str 0) #\-)
(string-every (cut member <> '(#\E #\e #\n)) (substring str 1))))
(define (echo . args)
(define (main . args)
(let* ((options (append-map (compose cdr string->list)
(take-while option? args)))
(args (drop-while option? args))