Commit Graph

22 Commits

Author SHA1 Message Date
Timothy Sample 6228064801 Fix top-level 'break', 'continue', and 'return'.
* gash/environment.scm (sh:break, sh:continue, sh:return): Wrap
'abort-to-prompt' with 'false-if-exception'.
* gash/built-ins/break.scm (main): Print warning and continue if
'sh:break' returns.
* gash/built-ins/continue.scm (main): Likewise, but for 'sh:continue'.
* gash/built-ins/return.scm (main): Likewise, but for 'sh:return'.
* tests/functions.org (Top-level return): New test.
* tests/spec/oil.scm: Enable previously failing test.
2019-08-01 09:02:05 -04:00
Timothy Sample 878b9c3dca Add support for Guile 2.0.9.
* gash/compat.scm: New file.
* gash/compat/hash-table.scm: New file.
* Makefile.am: Add them.
* .dir-locals.scm: Add indentation for 'if-guile-version-below'.
* guix.scm (guile-2.0.9): New variable.
* gash/built-ins/echo.scm (escape->control): Use '#\esc'.
* gash/environment.scm: Use '(gash compat hash-table)'.
* gash/built-ins/break.scm,
gash/built-ins/cd.scm,
gash/built-ins/command.scm,
gash/built-ins/continue.scm,
gash/built-ins/dot.scm,
gash/built-ins/exec.scm,
gash/built-ins/exit.scm,
gash/built-ins/pwd.scm,
gash/built-ins/return.scm,
gash/built-ins/set.scm,
gash/built-ins/shift.scm,
gash/built-ins/trap.scm,
gash/built-ins/type.scm,
gash/built-ins/umask.scm,
gash/eval.scm,
tests/unit/automake.scm: Use '(gash compat)'.

squash! Add support for Guile 2.0.9.
2019-05-20 18:07:47 -04:00
Jan Nieuwenhuizen 1cd6f963ea Allow setting the status with a Boolean.
* gash/environment.scm (set-status!): Allow numerical or boolean input.
2019-05-20 01:18:48 -04:00
Jan Nieuwenhuizen 13f43973f5 Do not export unset variables.
* gash/environment.scm (get-environ): Filter out unset variables.
* tests/42-sh-export-new.sh: New file.
* tests/42-sh-export-new.stdout: New file.
* Makefile.am (FULL_TESTS): Add tests/42-sh-export-new.sh.
(XFAIL_TESTS): Remove tests/42-export-new.sh and tests/42-sh-export.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:22 -04:00
Timothy Sample 50473ac9d4 Add copyright sign to headers.
* gash/built-ins/*, gash/environment.scm, gash/eval.scm,
gash/lexer.scm, gash/parser.scm, gash/repl.scm, gash/word.scm,
tests/unit/*, tools/coverage.in: Add copyright sign to headers.
2019-05-20 01:18:22 -04:00
Jan Nieuwenhuizen 2e4e078975 Fix some environment-dependent tests.
* gash/environment.scm (initial-variables): Add 'SHELL' and 'SHELLOPTS'.
* tests/100-cd.sh, tests/100-cd.stdout: Use '/tmp' instead of '/bin'.
* tests/50-redirect-in-out.sh, tests/50-redirect-space.sh,
tests/50-redirect.sh: Use '/tmp' and PID for temporary files.
* tests/50-redirect-sed.sh: Make sure 'DESTDIR' is unset and use
'/bin/GASH' in place of '/bin/gash'.
* tests/50-redirect-sed.stdout, tests/data/diff.scm: Use '/bin/GASH' in
place of '/bin/gash'.
* Makefile.am (FULL_TESTS): Add tests/50-redirect-sed.sh,
tests/50-redirect-space.sh, and tests/100-cd.sh; remove
tests/50-redirect-merge.sh.
(BROKEN_TESTS): Remove tests/10-if-redirect.sh,
tests/50-redirect-sed.sh, tests/50-redirect-space.sh, and
tests/100-cd.sh; add tests/50-redirect-merge.sh.

Co-authored-by: Timothy Sample <samplet@ngyro.com>
2019-05-20 01:18:07 -04:00
Timothy Sample 1bd92e2893 Remove (almost) all references to Geesh.
gash/environment.scm: Remove file.
geesh/*: Move these files into the 'gash' folder and replace all
instances of the word 'geesh'.
scripts/geesh.in: Remove file.
HACKING, INSTALL, Makefile.am, configure.ac, guix.scm,
tests/bootstrap/bash-without-bash.scm, tests/spec/Makefile.am,
tests/spec/check-spec, tests/spec/oil.scm, tests/unit/*,
tools/coverage.in: Replace all instances of the word 'geesh'.

Co-authored-by: Jan Nieuwenhuizen <janneke@gnu.org>
2019-05-20 01:17:40 -04:00
Jan Nieuwenhuizen 73ecccef1e fix 01-script-$@. 2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen 1f0a7674d9 fix 01-script-$#. 2018-12-02 09:03:02 +01:00
Jan Nieuwenhuizen 1162f37d19 test: 07-variable-or-empty. 2018-11-25 11:53:29 +01:00
Jan Nieuwenhuizen b2f5004eb6 01-script-$0.sh, 01-script-$@.sh: add test and fix. 2018-11-24 12:25:24 +01:00
Jan Nieuwenhuizen 43f79811aa fix 07-variable-or-variable.sh. 2018-11-24 10:55:24 +01:00
Rutger van Beusekom c20ac38ace fix 08-variable-not-and.sh 2018-11-14 19:46:02 +01:00
Rutger van Beusekom da105e0e81 fix 05-assignment-empty.sh 2018-11-14 19:31:00 +01:00
Jan Nieuwenhuizen 8d0d50240b Support functions. 2018-11-05 20:16:39 +01:00
Jan Nieuwenhuizen bca65e807b Support ${foob-bar} and ${foo+bar}.
* gash/environment.scm (variable): Add default parameter.
(variable-or, variable-and): New function.
* test/07-variable-or.sh: Test it.
* test/07-variable-or-not.sh:
* test/08-variable-and.sh:
* test/08-variable-and-not.sh:
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen a0ff0853ff set: Support -u, clumped singles.
* gash/builtins.scm (set-command): Support -u, clumped singles.
* gash/environment.scm (variable): Consider `nounset'.  TODO:
propagate error.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 1f9480cda1 Guile As SHell. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 0f5b538c3a geesh: initial integration.
GUILE_LOAD_PATH=$HOME/src/geesh:$GUILE_LOAD_PATH
    GUILE_LOAD_COMPILED_PATH=$HOME/src/geesh:$GUILE_LOAD_COMPILED_PATH

    bin/gash --parse -c 'echo boo | sed s,o,O, | grep .'
    bin/gash --geesh --parse -c 'echo boo | sed s,o,O, | grep .'
2018-10-21 12:45:51 +02:00
Jan Nieuwenhuizen 83f20d1ff8 flatten-fu 2018-07-15 20:06:19 +02:00
Jan Nieuwenhuizen 8f8ba68c54 resurrect set -x 2018-07-15 18:18:34 +02:00
Jan Nieuwenhuizen 56a36baee5 factor-out environment.
* gash/environment.scm: New file.
* build-aux/build-guile.sh (SCM_FILES): Add it.
* gash/peg.scm: Include it.
  (assignment, %global-variables, set-shell-opt!, variable): Remove.
2018-07-14 15:23:52 +02:00