bjo fmt
The project commands table has bjo fmt, and a paragraph says what it does: indent as bjo-mode does, closing brackets up Lisp style, the whitespace tidied, --check for CI, - for an editor, and the lines it makes wider than 100 columns named. 🤖 Generated with [ECA](https://eca.dev) Co-Authored-By: eca-agent <git@eca.dev>
This commit is contained in:
parent
1e7c54fcc6
commit
0e6ff36076
1 changed files with 3 additions and 0 deletions
|
|
@ -308,11 +308,14 @@ Because @code{bjo} automatically detects the project root by walking upward unti
|
|||
| @code{bjo build} | Fetches dependencies and compiles the program or library |
|
||||
| @code{bjo run . args ...} | Builds and runs the project with the specified arguments |
|
||||
| @code{bjo check} | Type-checks the entire project without emitting output binaries |
|
||||
| @code{bjo fmt} | Lays out the project's source the way @code{bjo-mode} does |
|
||||
| @code{bjo repl} | Starts the REPL preloaded with access to the project's modules |
|
||||
}
|
||||
|
||||
In @code{bjo run . one two}, the dot specifies the project itself. Any arguments following the target are forwarded directly to the program's @code{main} function, binding @code{args} to @code{[one two]}. You can also point @code{bjo run} at a specific test file, such as @code{bjo run tests/deck-test.bjo}; the file will be compiled and linked against the project's declared packages.
|
||||
|
||||
@code{bjo fmt} indents every line the way @code{indent-region} does in Emacs's @code{bjo-mode}, so the two always agree. It also moves a line of closing brackets up onto the line before it, Lisp style, removes trailing whitespace, and turns three or more blank lines into two. Line breaks are otherwise kept, and the lines of a string are never touched. Since it only moves text to the right, it names every line it makes wider than 100 columns, so that you can break it by hand. With no arguments it lays out every file under @code{src/}, @code{tests/} and @code{benches/}; you can also name files or directories. @code{bjo fmt --check} changes nothing, names the files that are not laid out, and fails if there are any, which is what a CI job wants. @code{bjo fmt -} reads standard input and writes the result to standard output, for an editor. A file whose brackets do not pair up, or that has a string that does not end, is refused with the line where it goes wrong.
|
||||
|
||||
@subsubsection{Modules only the package may use}
|
||||
|
||||
An export list says what a module offers, but once a module is exported, any module can import it. As a package grows you want helpers that the package's own modules share without them becoming part of what the package offers to others. Put them in a directory whose name starts with an underscore:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue