From b68f8c322392509268878c4de1ce6836062d8992 Mon Sep 17 00:00:00 2001 From: Jan Nieuwenhuizen Date: Mon, 12 Nov 2018 07:14:05 +0100 Subject: [PATCH] connect backend: WIP --- gash/bournish-commands.scm | 8 ++++---- gash/script.scm | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/gash/bournish-commands.scm b/gash/bournish-commands.scm index 4a0d089..de42daa 100644 --- a/gash/bournish-commands.scm +++ b/gash/bournish-commands.scm @@ -31,11 +31,11 @@ #:use-module (gash config) #:use-module (gash shell-utils) - #:use-module (gash commands basename) + #:use-module ((gash commands basename) #:prefix gash:) #:use-module (gash commands cat) #:use-module (gash commands compress) #:use-module (gash commands cp) - #:use-module (gash commands dirname) + #:use-module ((gash commands dirname) #:prefix gash:) #:use-module (gash commands find) #:use-module (gash commands grep) #:use-module (gash commands ls) @@ -78,11 +78,11 @@ ((quit) (car args)) (else 1))))))) -(define basename-command (wrap-command basename "basename")) +(define basename-command (wrap-command "basename" gash:basename)) (define cat-command (wrap-command cat "cat")) (define compress-command (wrap-command "compress" compress)) (define cp-command (wrap-command "cp" cp)) -(define dirname-command (wrap-command "dirname" dirname)) +(define dirname-command (wrap-command "dirname" gash:dirname)) (define find-command (wrap-command "find" find)) (define grep-command (wrap-command "grep" grep)) (define ls-command (wrap-command "ls" ls)) diff --git a/gash/script.scm b/gash/script.scm index 84649d3..1530d69 100644 --- a/gash/script.scm +++ b/gash/script.scm @@ -168,7 +168,9 @@ (match o ((h t ...) (append (flatten h) (append-map flatten t))) (_ (list o)))) - (string-join (flatten o) "")) + (match o + (((? string?) ...) (string-join (flatten o) "")) + (_ o))) (define-syntax-rule (substitution commands) (string-trim-right (with-output-to-string (lambda _ commands)))) @@ -368,3 +370,14 @@ replace (substring value (match:end match))) value)))) + +(define (compound . o) + (match (warn 'compound o) + ((h ... t) t) + (_ o))) + +(define (delim o) + o) + +(define (name o) + o)