The editor suggests history lines whose command exists, cd lines by the frecency of their directory, paths ignoring case, and the visited directory that cd KEYWORD... goes to. Tab completes arguments with fish's completions when fish is on PATH, and paths by the start of each part (~/P/B/B). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
2.4 KiB
Markdown
50 lines
2.4 KiB
Markdown
# bjosh
|
|
|
|
A shell in Bjolang. The design and the phases are in `plan.org`.
|
|
|
|
## Comments
|
|
|
|
Write clear, direct engineering comments, as in the Bjolang repo's
|
|
CLAUDE.md: "returns" and "raises", contracts and invariants, bullets for
|
|
non-trivial functions. No essays.
|
|
|
|
## This package
|
|
|
|
- `bjo build` builds the shell: `src/main.exe`. `bin/bjosh` starts it with
|
|
dotnet. No Native AOT: it cannot load the user's commands.
|
|
- `bjo test` runs the tests. `tests/run.bjo` and `tests/interactive.bjo`
|
|
run `src/main.exe`, so run `bjo build` first.
|
|
- It depends on bjoterm, fetched from rikspucko by its version tag and
|
|
pinned in `bjo.lock`. A change in bjoterm needs a new tag there, and a
|
|
higher `version-at-least` here. To work on both at once, put the path
|
|
source `(source (path (dir "../bjoterm")))` in the manifest for the time
|
|
being.
|
|
- Modules:
|
|
- `(bjosh syntax)`: the parser, with `(text parser-combinators)`.
|
|
- `(bjosh expand)`: variables, `~`, `$(...)` and globs.
|
|
- `(bjosh shell)`: the state, variables, aliases and the job table.
|
|
- `(bjosh builtins)`: the shell commands.
|
|
- `(bjosh exec)`: lines to `(std run)` forms and jobs, aliases, and
|
|
the subshell of `$(...)`.
|
|
- `(bjosh values)`: values (`Json`), streams of them, text and tables.
|
|
- `(bjosh commands)`: the value commands, and their table.
|
|
- `(bjosh pipeline)`: value commands next to each other, as one unit.
|
|
- `(bjosh editor)`: when Enter runs a line, the completer (fish's
|
|
completions when fish is on PATH), and the suggester.
|
|
- `(bjosh dirs)`: the visited directories, ranked by frecency, saved in
|
|
`$XDG_STATE_HOME/bjosh/dirs`.
|
|
- `(bjosh api)`: what a package of user commands imports: `Extension`,
|
|
`ShellCommand`, `ShellView`.
|
|
- `(bjosh user)`: builds and loads the package of user commands, in
|
|
`$XDG_CONFIG_HOME/bjosh/commands`, with `(std plugin)`.
|
|
- Tests:
|
|
- `tests/syntax.bjo`, `tests/expand.bjo`, `tests/editor.bjo`: unit tests.
|
|
- `tests/run.bjo`: lines through `bjosh -c`, a file, and stdin.
|
|
- `tests/values.bjo`: the value commands through `bjosh -c`.
|
|
- `tests/interactive.bjo`: job control, the prompt and the start-up
|
|
file under `script`.
|
|
- `tests/extension.bjo`: user commands and their prompt, in a package
|
|
that the test writes.
|
|
- The tests that run bjosh with `-c` load the user commands of your own
|
|
`XDG_CONFIG_HOME`, when there are any. `tests/extension.bjo` and
|
|
`tests/interactive.bjo` set it to a directory of their own.
|