Commit Graph

9 Commits

Author SHA1 Message Date
Ludovic Courtès 3b4d7cdccc
bournish: Prevent inlining of run-time support procedures.
On Guile 3, those procedures could be inlined, leading to
unbound-variable errors:

  scheme@(guile-user)> ,bournish
  Welcome to Bournish, a minimal Bourne-like shell!
  To switch back, type `,L scheme'.
  bournish@(guile-user)> ls
  ice-9/boot-9.scm:1669:16: In procedure raise-exception:
  Unbound variable: ls-command-implementation

Reported by Ricardo Wurmus.

* guix/build/bournish.scm (define-command-runtime): New macro.
(ls-command-implementation, wc-command-implementation)
(wc-l-command-implementation, wc-c-command-implementation): Use it
instead of 'define'.
2020-04-02 16:07:08 +02:00
Ludovic Courtès 1812205cf5
bournish: 'ls' adjusts the column width depending on the entries.
* guix/build/bournish.scm (display-tabulated): Remove #:columns and
  #:column-width parameters.  Add #:terminal-width and #:column-gap.
  Compute COLUMN-WIDTH and COLUMNS.
2017-05-13 16:52:11 +02:00
Ludovic Courtès c7d1b061f5
bournish: 'ls' lists directory contents.
Suggested by Ricardo Wurmus.

* guix/build/bournish.scm (ls-command-implementation): When FILE is a
directory, list its contents rather than FILE itself.
2017-05-13 16:52:11 +02:00
Ricardo Wurmus 0db2ff65e7
bournish: Extend 'rm' command.
* guix/build/bournish.scm (rm-command): New procedure.
(%commands): Use it.
* tests/bournish.scm: Add tests for "rm" and "rm -r".
2017-01-26 13:49:56 +01:00
Ludovic Courtès 813bcbc4ea
bournish: Add 'reboot' command.
Suggested by Ricardo Wurmus.

* guix/build/bournish.scm (reboot-command): New procedure.
(%commands): Add it.
2016-10-10 21:40:23 +02:00
Efraim Flashner bae06364c1
bournish: Add 'wc' command.
* guix/build/bournish.scm (lines+chars, file-exists?*, wc-print)
(wc-l-print, wc-c-print, wc-command, wc-command-implementation)
(wc-l-command-implementation, wc-c-command-implementation): New procedures.
(%commands): Add 'wc'.

Co-authored-by: Ludovic Courtès <ludo@gnu.org>
2016-06-23 10:27:02 +02:00
Ludovic Courtès f82c58539e
bournish: Allow compilation of multiple expressions.
* guix/build/bournish.scm (%bournish-language): Add a joiner to SCHEME.
Compile only to Scheme.
* tests/bournish.scm: New file.
* Makefile.am (SCM_TESTS): Add it.
2016-06-06 18:14:52 +02:00
Ludovic Courtès 8bebe00a76
bournish: Handle EOF in the reader.
* guix/build/bournish.scm (read-bournish): Add case for EOF.
2016-06-06 18:14:52 +02:00
Ludovic Courtès f2e4805b7e Add (guix build bournish) and use it in the initrd.
* guix/build/bournish.scm: New file.
* Makefile.am (MODULES): Add it.
* gnu/system/linux-initrd.scm (base-initrd): Add (guix build bournish)
and use it.
2016-02-08 23:46:46 +01:00