Commit Graph

173 Commits

Author SHA1 Message Date
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
Jan Nieuwenhuizen 92d2896134 tar: Support extraction.
* gash/ustar.scm (extract-ustar-file):
* gash/ustar.scm (<ustar-header>): New record type.
(bv->ustar-string, bv->ustar-number, bv->ustar-0string,
sub-bytevector, read-ustar-header, extract-ustar-file): New function.
Implement extraction.
2018-10-29 14:51:00 +01:00
Jan Nieuwenhuizen 03fc5c928a Add mkdir-p.
* gash/guix-build-utils.scm (mkdir-p): New function, import from Guix.
2018-10-27 11:31:22 +02:00
Jan Nieuwenhuizen 3c57272971 Add delete-file-recursively.
* gash/guix-build-utils.scm (delete-file-recursively): New function,
import from Guix.
2018-10-27 11:31:22 +02:00
Jan Nieuwenhuizen 904eecbb2c Expose all bournish commands as external command.
* bin/builtin.in: New file.
* bin/tar.in: Remove.
* configure: Generate bin/<builtin> for all bournish-commands.
* build-aux/build-guile.sh: Compile them.
* .gitignore: Ignore them.
2018-10-27 11:31:22 +02:00
Jan Nieuwenhuizen 70d28ea480 Make tar a bournish-command.
* bin/gash.in: Make Scheme script.
* bin/tar.in: Likewise.
* gash/bournish-commands (tar-command): New command, move from
tar.scm.
(%bournish-commands): Add it.
* gash/tar.scm: Remove.
2018-10-27 11:31:22 +02:00
Jan Nieuwenhuizen b8b170530c bournish: Add tar, from Guile100 challenge by Mark Weaver.
See https://github.com/spk121/guile100

* bin/tar.in: New file.
* configure: Produce bin/tar.
* .gitignore: Ignore it.
* makefile (bin/tar): New target.
* gash/tar.scm: New file.
* gash/ustar.scm: New file.
* build-aux/build-guile.sh: Compile new files.
2018-10-27 11:30:45 +02:00
Jan Nieuwenhuizen 019464acf6 fix: set -e. 2018-10-21 16:13:29 +02:00
Jan Nieuwenhuizen 13cb50af60 gash: resurrect. 2018-10-21 15:24:24 +02: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 9462aaa163 checkpoint 2018-07-16 07:50:28 +02:00
Jan Nieuwenhuizen 292fbc5ecb test/if.sh, test/if2.sh -- weird 2018-07-15 23:27:58 +02:00
Jan Nieuwenhuizen 6468b04791 refactor WORD...bummer: word-for-test-assign-sh word-for-test-if-sh 2018-07-15 23:01:52 +02:00
Jan Nieuwenhuizen 24c35cc5d9 checkpoint 2018-07-15 21:44:15 +02:00
Jan Nieuwenhuizen 1f5c82ecae word! test/if.sh, test/assign.sh 2018-07-15 21:35:42 +02:00
Jan Nieuwenhuizen cbd13fdc88 checkpoint 2018-07-15 20:49:52 +02:00
Jan Nieuwenhuizen e7bfd347fa checkpoint 2018-07-15 20:47:09 +02:00
Jan Nieuwenhuizen 83f20d1ff8 flatten-fu 2018-07-15 20:06:19 +02:00
Jan Nieuwenhuizen e9a57a899c more for-progress 2018-07-15 18:39:17 +02:00
Jan Nieuwenhuizen bfc39b1a18 test: implement -n, -z, !=. 2018-07-15 18:19:56 +02:00
Jan Nieuwenhuizen 8f8ba68c54 resurrect set -x 2018-07-15 18:18:34 +02:00
Jan Nieuwenhuizen 85b90e8537 job: disable backgrounding 2018-07-15 16:32:43 +02:00
Jan Nieuwenhuizen e6e03c6da2 parser: handle substitution in for sequence. 2018-07-15 16:08:26 +02:00
Jan Nieuwenhuizen c32034d13d command, builtin, glob, echo cleanup and fixes 2018-07-15 13:43:52 +02:00
Jan Nieuwenhuizen d065723221 parser: refactor, use `pipeline' instead of `expression'. 2018-07-15 12:49:59 +02:00
Jan Nieuwenhuizen 9623e014f0 builtins: [: New command.
* gash/builtins (bracket-command): New function.
  (%builtin-commands): Add it.
2018-07-15 12:23:27 +02:00
Jan Nieuwenhuizen 4bb60cc4c3 parse: handle empty script WIP 2018-07-14 23:16:27 +02:00
Jan Nieuwenhuizen b20306e123 builtins: grep: New command.
* gash/guix-build-utils.scm (<grep-match>): New record type.
  (grep): New function.
* gash/builtins.scm (grep-command): New command.
  (%builtin-commands): Add it.
2018-07-14 23:16:27 +02:00
Jan Nieuwenhuizen 0cab9321b2 builtins: test: Enhance with file tests.
* gash/guix-build-utils.scm (directory-exists?, executable-file?,
  symbolic-link?): Import from Guix.
* gash/builtins.scm (test-command): Use them to enhance with file test.
2018-07-14 23:16:27 +02:00
Jan Nieuwenhuizen 863b3b5908 builtins: test: New command.
* gash/builtins.scm (test-command): New command.
  (%builtin-commands): Add it.
  (builtin, command, doublequotes, expression, for, glob,
  singlequotes, substitution): Move from peg.scm.
* gash/peg.scm: Remove them.
2018-07-14 23:16:13 +02:00
Jan Nieuwenhuizen 48373edb3f WIP: IF hack 2018-07-14 22:48:55 +02:00
Jan Nieuwenhuizen de6d653c7c builtins: type: New command.
* gash/builtins.scm (type-command): New function.
  (%builtin-commands): Add it.
2018-07-14 22:48:55 +02:00
Jan Nieuwenhuizen 677deaf9b3 builtins: command: New command.
* gash/builtins.scm   (command-command): New command.
  (%builtin-commands): Add it.
  (builtin): Move from peg.
* gash/peg.scm (builtin): Remove.
2018-07-14 22:48:42 +02:00
Jan Nieuwenhuizen 0408463a13 bah, some uninformed error handling. WIP 2018-07-14 22:48:42 +02:00
Jan Nieuwenhuizen 870fc792d7 debug du WIP 2018-07-14 22:48:42 +02:00
Jan Nieuwenhuizen 2c30f3c4c6 builtins: find: First naive implementation.
* gash/builtins.scm (find-command-implementation): New function.
  (find-command): New command.
  (%builtin-commands): Add it.
* gash/guix-build-utils.scm (file-name-predicate, find-files): Import
  from Guix.
2018-07-14 22:48:42 +02:00
Jan Nieuwenhuizen e0169d0acd builtins: Support \non-builtin escape.
* gash/peg.scm (builtin): Add #:prefer-builtin? keyword argument.
  (transform): Support \non-builtin escape.
2018-07-14 15:57:02 +02:00
Jan Nieuwenhuizen e5c6324d82 remove debugging WIP: 2018-07-14 15:56:46 +02:00
Jan Nieuwenhuizen 43d418fab1 some builtin progress WIP 2018-07-14 15:41:03 +02:00
Jan Nieuwenhuizen 97a95ee002 builtins: cd: Support `cd -'.
* gash/builtins.scm (cd-command): Support `cd -'.
2018-07-14 15:23:52 +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
Jan Nieuwenhuizen 23a13b0890 builtins: resurrect pwd WIP 2018-07-14 15:23:52 +02:00
Jan Nieuwenhuizen 3ea368ab2f resurrect help WIP 2018-07-14 15:23:52 +02:00