diff --git a/Makefile.am b/Makefile.am index 5a4fa26..1efbaa0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,6 +48,7 @@ MODULES = \ geesh/built-ins/false.scm \ geesh/built-ins/read.scm \ geesh/built-ins/readonly.scm \ + geesh/built-ins/set.scm \ geesh/built-ins/true.scm \ geesh/built-ins/unset.scm \ geesh/built-ins/utils.scm \ diff --git a/geesh/built-ins.scm b/geesh/built-ins.scm index 249cf31..cf29b01 100644 --- a/geesh/built-ins.scm +++ b/geesh/built-ins.scm @@ -42,7 +42,7 @@ ("export" . ,(@@ (geesh built-ins export) main)) ("readonly" . ,(@@ (geesh built-ins readonly) main)) ("return" . ,undefined) - ("set" . ,undefined) + ("set" . ,(@@ (geesh built-ins set) main)) ("shift" . ,undefined) ("times" . ,undefined) ("trap" . ,undefined) diff --git a/geesh/built-ins/set.scm b/geesh/built-ins/set.scm new file mode 100644 index 0000000..2d721f5 --- /dev/null +++ b/geesh/built-ins/set.scm @@ -0,0 +1,33 @@ +;;; The Geesh Shell Interpreter +;;; Copyright 2018 Timothy Sample +;;; +;;; This file is part of Geesh. +;;; +;;; Geesh 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. +;;; +;;; Geesh 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 Geesh. If not, see . + +(define-module (geesh built-ins set) + #:use-module (geesh environment) + #:use-module (ice-9 match)) + +;;; Commentary: +;;; +;;; The 'set' utility. +;;; +;;; Code: + + +(define (main env . args) + (match args + (("--" . args) (set-environment-arguments! env args)) + (_ (throw 'not-implemented (string-join (cons "set" args)))))) diff --git a/geesh/environment.scm b/geesh/environment.scm index 3ab50a9..637c3f6 100644 --- a/geesh/environment.scm +++ b/geesh/environment.scm @@ -38,6 +38,7 @@ define-environment-function! delete-environment-functions! environment-arguments + set-environment-arguments! with-environment-arguments environment-break-prompt environment-continue-prompt))