Commit Graph

215 Commits

Author SHA1 Message Date
Jan Nieuwenhuizen 1e51c5cbd1 basename: New builtin.
* gash/commands/basename.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (basename-command): New variable.
(%bournish-commands): Add it.
2018-11-05 20:46:25 +01:00
Jan Nieuwenhuizen f014281c29 dirname: New builtin.
* gash/commands/dirname.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (dirname-command): New variable.
(%bournish-commands): Add it.
2018-11-05 20:46:25 +01:00
Jan Nieuwenhuizen e8b56af461 pipeline: Fix stray outputs.
* gash/pipe.scm (pipeline+): Do not add extra newlines, flush.
2018-11-05 20:16:39 +01:00
Jan Nieuwenhuizen 8f87f7dffa Support io-here. 2018-11-05 20:16:39 +01:00
Jan Nieuwenhuizen 8d0d50240b Support functions. 2018-11-05 20:16:39 +01:00
Jan Nieuwenhuizen a8a6ea06df compress WIP 2018-11-05 20:16:39 +01:00
Jan Nieuwenhuizen 9cf3ee9e7e WIP > redir 2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen f2fb1bedc9 tar: Cater for Guix bootstrap-guile's UTF-8 default.
* gash/ustar.scm (read-ustar-file): Cater for Guix bootstrap-guile's
UTF-8 default.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 478d75bba7 touch: New builtin.
* gash/commands/touch.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (touch-command): New variable.
(%bournish-commands): Add it.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 78989bfb90 Fix command tracing.
* gash/builtins.scm (term->string): New function.
(trace): Use it to make nicer traces; typo: alway display trace.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 6250b22951 Support && and ||.
* gash/script.scm (and-terms, or-terms): New macros.
* gash/peg.scm (transform): Transform to use them.
(parse-): Parse && and || as binary term operator.
* test/20-and.sh: Test it.
* test/20-or.sh: Test it.
* check.sh (tests): Run it.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 45479fc651 rmdir: New builtin.
* gash/commands/rmdir.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (rmdir-command): New variable.
(%bournish-commands): Add it.
* gash/shell-utils.scm (rmdir-p): New function.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen f62e6e99a7 mkdir: New builtin.
* gash/commands/mkdir.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/bournish-commands.scm (mkdir-command): New variable.
(%bournish-commands): Add it.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 678e192b4f chmod: Move permission code to shell-utils.
* gash/shell-utils.scm (<chmodifier>): New record, move from commands/chmod.
(parse-modifier, parse-modifiers, make-numeric-chmodifier,
apply-chmodifiers): New function, move from commands/chmod.
* gash/commands/chmod.scm (chmod): Remove them.
* gash/util.scm (char->string, string->string-list): New function.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 6e396759a3 reboot: Use reboot'.
* gash/commands/reboot.scm (reboot'): Rename from reboot.  Update
users.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 8bcc6d3c82 tar: Extract fix.
* gash/ustar.scm (read-ustar-file): Use binary output port.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 63f2d4b5f8 tar: Support symlinks.
* gash/ustar.scm (read-ustar-file): Support symlinks.
* gash/shell-utils.scm (display-file): Display them.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 005061d712 tar: Support -C.
* gash/commands/tar.scm (tar): Support -C.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen d13de88e43 tar: Support --strip-components.
* gash/commands/tar.scm (tar): Support --strip-components.
* gash/ustar.scm (list-ustar-archive, list-ustar-port,
read-ustar-archive, read-ustar-port, read-ustar-file): Likewise.
2018-11-05 20:13:26 +01:00
Jan Nieuwenhuizen 2a4e3ec71b Support escaped newline.
* gash/peg.scm (parse-): Support escaped newline.
* test/01-script-backslash.sh: Test it.
2018-11-05 20:13:26 +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 418652bee1 test: Refactor. 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 ac30e252bd Make dependency on geesh optional. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 992e12444d chmod: New builtin.
* gash/commands/chmod.scm: New file.
* build-aux/build-guile.sh: Compile it.
* .gitignore: Ignore it.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 6175b07c7e pipe: Connect stderr too.
* gash/pipe.scm (spawn): Connect stderr too.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen aafbc96dbd rm: Resurrect.
* gash/commands/rm.scm: Resurrect.
* gash/bournish-commands.scm: Add it.
* build-aux/build-guile.sh: Compile it.
* .gitignore: Ignore it.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 6224bbeefc test: tar. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen ab4ce3b995 test: Add check-geesh. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 6203f8cf07 test: Update test suite. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 1f9480cda1 Guile As SHell. 2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen d626cdb136 build: Fixes.
* build-aux/trace.sh: Import from Mes.
* build-aux/build-guile.sh: Update from Mes.
* makefile: Avoid endless reconfigure.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen f27cb9a192 sed: New builtin.
* gash/commands/sed.scm: New file.
* build-aux/build-guile.sh: Compile it.
* configure: Create script.
* gash/shell-utils.scm (with-atomic-file-replacement,
substitute*): New function, Import from Guix.
(substitute-port): New function.
2018-11-05 19:59:53 +01:00
Jan Nieuwenhuizen 9d1d2be6a6 test: Add expectations.
* check.sh: New file, from test.sh.
* test.sh: Run single test with expectations.
2018-11-03 08:02:49 +01:00
Jan Nieuwenhuizen b433052b4a builtins: Split out into gash/commands/.
* gash/commands/cat.scm: New file, expand from bournish-commands.scm.
* gash/commands/compress.scm: Likewise.
* gash/commands/cp.scm: Likewise.
* gash/commands/find.scm: Likewise.
* gash/commands/grep.scm: Likewise.
* gash/commands/ls.scm: Likewise.
* gash/commands/reboot.scm: Likewise.
* gash/commands/tar.scm: Likewise.
* gash/commands/wc.scm: Likewise.
* gash/commands/which.scm: Likewise.
* build-aux/pre-inst-env.in: New file.
* configure: Expand it.
* gash/bournish-commands.scm: Remove.
* gash/shell-utils.scm: Rename from guix-build-utils.scm.
2018-11-03 08:02:49 +01:00
Jan Nieuwenhuizen 1e5389f01d builtins: Oops, have \NAME run builtin.
* gash/script.scm (command): Oops have \NAME run builtin.
(pipeline): Filter-out #<unspecified> (xtrace residue).
2018-10-30 17:39:05 +01:00
Jan Nieuwenhuizen 3e8b021f0b bournish: Do not display help if --version is requested.
* gash/bournish-commands.scm (ls-command-implementation): Do not
display help if --version is requested.
(find-command-implementation): Likewise.
(grep-command): Likewise.
(tar-command): Likewise.
(compress-command): Likewise.
2018-10-29 22:55:05 +01:00
Jan Nieuwenhuizen 5296fdbf2c tar: Use latin-1 (binary) codec instead of utf8. 2018-10-29 22:55:05 +01:00
Jan Nieuwenhuizen b463aa32bc tar: Handle extracting of directories.
* gash/ustar.scm (read-ustar-file): Do not dump content of directory.
Size is 0; do not start by reading 512 bytes.
2018-10-29 22:55:05 +01:00
Jan Nieuwenhuizen 1fd796bad7 guix: build fixes.
* bin/builtin.in: Remove gratuitous quotes.
* configure (BUILTINS): Add bash and sh scripts.
* gash/builtins.scm (command-command): Add missing format parameter.
(type-command): Likewise.
* gash/guix-build-utils.scm: Use (ice-9 format).
* gash/guix-utils.scm: Likewise.
* gash/ustar.scm (write-ustar-port): Remove catch.
(read-ustar-port): Likewise.
2018-10-29 22:09:34 +01:00
Jan Nieuwenhuizen f7c1dd6e72 Make readline optional.
* gash/readline.scm: New file.
* build-aux/build-guile.sh: Compile it.
* gash/gash.scm: Use it as fallback.
2018-10-29 21:22:32 +01:00
Jan Nieuwenhuizen d2133b8502 tar: Support old cvf/xvf and auto-compress.
* gash/bournish-commands.scm (tar-command): Support old cvf/xvf and
auto compress (use archive suffix to determine the compression.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen a10247aab1 tar: Support compression.
* gash/guix-utils.scm: New file, partial import from Guix.
Throughout: Add `compress.'
* build-aux/build-guile.sh: Compile it.
* gash/config.scm.in: Support it by defining compressors.
* configure: Substitute them.
* gash/bournish-commands.scm (tar-command): Use it to have tar support
compression and decompression.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen e3e20738c2 tar: Handle stdin, stdout.
* gash/ustar.scm (list-ustar-port, extract-ustar-port,
write-ustar-port): New function.
* gash/bournish-commands.scm (tar-command): Use them.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 8b56dcc2ab compress: play nice with GNU tar.
* gash/bournish-commands.scm (compress-command): Compress/decompress
from stdin if not tty.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 975f53d98e bournish: Add compress, from Guile100 challenge by Daniel Hartwig. WIP 2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 8aad645152 ls: Support -l.
* gash/bournish-commands.scm (ls-command-implementation): Support -l.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 4e671558e5 tar: Nicer verbose listing of files.
* gash/guix-build-utils.scm (display-file): New function.
* gash/ustar.scm (display-header): Use it.
(ustar-header->stat): New function.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 28d62b6169 tar: Support --list and --verbose.
* gash/ustar.scm (extract-ustar-file): Add keyword argument: extract?
(extract-ustar-archive): Add keyword arguments: extract?, verbose?:
(display-rwx, display-header, list-ustar-archive): New function
* gash/bournish-commands.scm (tar-command): Support --list, --verbose.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 463b71acc9 tar: Support creation of deterministic archives.
* gash/ustar.scm (write-ustar-header, write-ustar-file): Accept
keyword arguments: group mtime numeric-owner? owner.
(create-ustar-archive): Likewise.  Rename from write-ustar-archive.
* gash/bournish-commands.scm (tar-command): Support --group, --mtime,
--numeric-owner, --owner and --sort.
2018-10-29 14:51:00 +01:00