Files
rash-coreutils/README.md
T

72 lines
2.1 KiB
Markdown

# rash-coreutils
Portable Unix-style commands for Rash, implemented in Racket.
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.
```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.
## 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.
```text
pwd
C:/devel/racket/rash-coreutils/
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))`.