Aded extended commands and editor

This commit is contained in:
2026-08-20 23:48:49 +02:00
parent 72bf39a27b
commit 4324da1467
12 changed files with 1616 additions and 261 deletions
+42 -9
View File
@@ -1,31 +1,63 @@
# rash-coreutils
Portable Unix-style core utilities for Rash, implemented in Racket.
Portable Unix-style commands for Rash, implemented in Racket.
Version 0.2.9 includes text/pipeline tools (`head`, `tail`, `wc`, `sort`, `uniq`,
`cut`, `tee`, `tr`), path and filesystem helpers (`basename`, `dirname`,
`realpath`, `readlink`, `stat`, `du`, `df`, `mktemp`), environment commands
(`printenv`, `env`), and `date` backed by Gregor.
Version 0.2.14 adds the `edit` command backed by the `rackedit` package and
reworks the manual around the commands that are available directly in Rash.
The manual now describes, per command, which internal `coreutils-*` Racket
procedure implements it.
Rash remains responsible for shell syntax such as globbing, pipelines and
redirection. `rash-coreutils` additionally accepts Racket regular expressions as
path selectors.
## Editing
`edit` opens one file using the editor configured by `current-coreutils-editor`.
The default editor is RackEdit's `rkdt` procedure.
```text
edit notes.rkt
edit --wait notes.rkt
```
`--wait` is passed to RackEdit as `#:wait? #t`. In ordinary Racket code a
different editor can be selected dynamically by parameterizing
`current-coreutils-editor` with a procedure that accepts a file path and the
`#:wait?` keyword.
## Command timing
`time` executes one rash-coreutils command or executable and writes timing data
to standard error. Command output therefore remains suitable for pipelines and
redirection. The portable measurements are elapsed (`real`) time, combined CPU
time (`cpu`) for Racket and completed subprocesses, and Racket garbage-collection
time (`gc`).
```text
time head -n 100 large.txt
time raco test tests/coreutils.rkt
```
## Racket tooling
`rash-coreutils` also exposes the `raco` command from the active Racket installation, without requiring `raco` to be on PATH.
`rash-coreutils` also exposes the `raco` command from the active Racket
installation, without requiring `raco` to be on PATH.
```text
raco setup rash-coreutils
raco pkg show
```
In Racket expression mode, use `coreutils-raco`, for example `(coreutils-raco '(setup rash-coreutils))`. The name `raco` is reserved for the Rash command binding.
In Racket expression mode, use `coreutils-raco`, for example
`(coreutils-raco '(setup rash-coreutils))`. The name `raco` is reserved for the
Rash command binding.
## Windows paths
Commands that print paths use forward slashes on Windows. This keeps their textual output directly reusable in Rash line mode, where a backslash is an escape character. Internally, Racket path values remain native paths.
Commands that print paths use forward slashes on Windows. This keeps their
textual output directly reusable in Rash line mode, where a backslash is an
escape character. Internally, Racket path values remain native paths.
```text
pwd
@@ -35,4 +67,5 @@ mktemp
C:/Users/hans/AppData/Local/Temp/tmp123
```
A native Racket path value can still be passed directly, for example `ls (values (find-system-path 'temp-dir))`.
A native Racket path value can still be passed directly, for example
`ls (values (find-system-path 'temp-dir))`.