Add a language specification.
* language/sh/spec.scm: New file. * Makefile.am (SOURCES): Add it. * doc/gash.texi (Using Gash from the Guile REPL): New section.
This commit is contained in:
parent
8cbb4803c8
commit
8f9b973264
|
@ -75,7 +75,8 @@ SOURCES = \
|
|||
gash/readline.scm \
|
||||
gash/repl.scm \
|
||||
gash/shell.scm \
|
||||
gash/word.scm
|
||||
gash/word.scm \
|
||||
language/sh/spec.scm
|
||||
|
||||
bin_SCRIPTS = \
|
||||
scripts/gash
|
||||
|
|
|
@ -247,6 +247,22 @@ Print each command that is executed.
|
|||
@end table
|
||||
|
||||
|
||||
@node Using Gash from the Guile REPL
|
||||
@section Using Gash from the Guile REPL
|
||||
|
||||
Gash defines a language specification that extends Guile, allowing you
|
||||
to use shell syntax from the REPL. This is accomplished by using the
|
||||
@code{language} REPL command:
|
||||
|
||||
@example
|
||||
scheme@atchar{}(guile-user)> ,language sh
|
||||
Happy hacking with Guile as Shell! To switch back, type `,L scheme'.
|
||||
sh@atchar{}(guile-user)> echo "Hello Gash!"
|
||||
Hello Gash!
|
||||
$1 = 0
|
||||
@end example
|
||||
|
||||
|
||||
@node Missing features
|
||||
@section Missing features
|
||||
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
;;; Gash --- Guile As SHell
|
||||
;;; Copyright © 2020 Stephen J. Scheck <sscheck@singularsyntax.one>
|
||||
;;;
|
||||
;;; This file is part of Gash.
|
||||
;;;
|
||||
;;; Gash is free software: you can redistribute it and/or modify
|
||||
;;; it under the terms of the GNU General Public License as published by
|
||||
;;; the Free Software Foundation, either version 3 of the License, or
|
||||
;;; (at your option) any later version.
|
||||
;;;
|
||||
;;; Gash is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
;;;
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(define-module (language sh spec)
|
||||
#:use-module (gash environment)
|
||||
#:use-module (gash eval)
|
||||
#:use-module (gash parser)
|
||||
#:use-module (system base language)
|
||||
#:export (sh))
|
||||
|
||||
;;; Commentary:
|
||||
;;;
|
||||
;;; This module contains the language spec definition that extends
|
||||
;;; Guile allowing use of shell syntax from the REPL by invocation
|
||||
;;; of the ,language meta-command.
|
||||
;;;
|
||||
;;; Code:
|
||||
|
||||
(define-language sh
|
||||
#:title "Guile as Shell"
|
||||
#:reader (lambda (port env) (read-sh port))
|
||||
#:evaluator (lambda (x module) (eval-sh x) (get-status))
|
||||
#:printer write)
|
Loading…
Reference in New Issue