ant

command
v0.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 38 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command ant runs, checks, and evaluates Ant programs.

ant run file.ant [args...]   run a program
ant file.ant [args...]       the same, for a #!/usr/bin/env ant line
ant check [-json] [-strict] [path...]  type-check the files under the paths and every module they import
ant test [flags] [path...]   run the tests of the test files under the paths (spec/test.md)
ant fmt [--check] path...    format files in place, or list those that are not formatted
ant doc [file.ant] [name]    print a declaration's signature and doc comment
ant code <subcommand> ...    find declarations, uses, and types, and rename
ant lsp                      serve the Language Server Protocol to an editor
ant dap                      serve the Debug Adapter Protocol to an editor
ant --comp bash|zsh|fish     print the script that completes ant's commands in the shell
ant version                  print the version of ant
ant                          start a REPL

Exit status: 0 when the script ends or the check passes, 1 when the script returns an Err, the main goroutine panics, or the check finds errors, 2 when the program cannot be loaded or the usage is wrong. When an interrupt the program did not ask for ends the run, the command prints nothing and ends by that signal, SIGINT or SIGTERM, as a shell's child does, or exits with 130 where there are none. Os.exit sets its own status. ant fmt exits 1 when --check finds a file to change and 2 when a file cannot be read, parsed, or written. ant doc exits 1 when there is no such declaration. ant code exits 1 when nothing was found, a location is ambiguous, or a rename was refused, and 2 when the usage is wrong, a file cannot be read, parsed, or written, or an answer is incomplete. ant lsp exits 0 when the client sends shutdown and then exit, 1 when the connection ends otherwise. ant dap exits 0 when the client disconnects, 1 when the connection ends first.

ant check, and ant run when it cannot load or run a program, print each error as path:line:col: message, then the lines of code it is about, numbered, with what it covers underlined (the range the language server reports), then how many errors there were. A span longer than four lines shows its first two and its last. On a terminal the code is highlighted as the REPL highlights it; NO_COLOR or a dumb terminal turns the colors off. ant check -json instead writes each error to standard output as a JSON object on a line of its own.

ant doc and the REPL's :doc highlight signatures and examples on a terminal, preserving source line breaks and spacing. NO_COLOR, a dumb terminal, or redirected output disables highlighting.

The REPL evaluates each input on one session and prints every non-void result with String.from, on a terminal colored and, when it does not fit, an element to a line; _ reads the last result. An input goes on over more lines while it is unfinished, which on a terminal are edited together, indented after an opening brace, and recalled whole from the history. On a terminal it edits each line with the keys of readline (arrows, Home and End or Ctrl-A and Ctrl-E, Alt-B and Alt-F or Ctrl-arrows by word, Ctrl-W, Ctrl-K, Ctrl-U, Ctrl-L), highlights it as it is typed, and completes what can be written at the cursor: the names declared so far and the prelude's, members after a dot, the functions that take the left side after a pipe, the parameters of a call, the fields of a record, by its type or by the value a variable holds, and import paths. The first completion is suggested after the cursor, where Right or End takes it; Tab writes the only completion or the common prefix, and otherwise lists them and cycles through them, Shift-Tab backwards. Up and Down browse the history, kept in ~/.ant_history. Ctrl-C drops the line, and twice in a row ends the REPL with 130, as Ctrl-D on an empty line ends it with 0; Ctrl-C while an input runs ends it with 130, as it ends a run. NO_COLOR turns the colors off; without a terminal, or on a dumb one, the REPL reads lines as they come. A line that begins with a colon is a command: :type expr prints a type, :doc name a declaration of the standard library, :load file.ant evaluates a file, :reset starts a new session, :quit ends it, and :help lists them with the keys.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL