Documentation
¶
Overview ¶
Package clikit introduces the runtime that GSI-HPC's command-line tools share. It holds no API: each part of the kit is a package of its own, imported by its path:
github.com/GSI-HPC/go-clikit/termtext escaping untrusted text for a terminal, and display width github.com/GSI-HPC/go-clikit/progress spans carried in a context.Context, the JSONL event log, TRACEPARENT github.com/GSI-HPC/go-clikit/progress/display the live tree, the counter, plain lines for CI, the summary github.com/GSI-HPC/go-clikit/progress/cliprogress the words of --progress, a command's display, summary and event log github.com/GSI-HPC/go-clikit/progress/progresstest capturing and checking the events a command reports github.com/GSI-HPC/go-clikit/progress/mcpprogress a tool call's progress as MCP progress notifications github.com/GSI-HPC/go-clikit/progress/eventlog reading back the event log a program or its child wrote github.com/GSI-HPC/go-clikit/fanout bounded worker pools that report their targets as progress github.com/GSI-HPC/go-clikit/fanout/fanouttest counting the calls a fake is in the middle of, to prove a limit github.com/GSI-HPC/go-clikit/cliout a command's result as a table and as JSON, escaped for a terminal github.com/GSI-HPC/go-clikit/cobratree a strict cobra command tree, usage errors, the build info github.com/GSI-HPC/go-clikit/cobratree/cobratreetest running a command tree in a test, checking a manual's command lines
A library package reports what it does through progress, which costs nothing when no command is listening, and runs work for many targets with fanout. A command decides how the work is shown: it creates a progress.Bus, attaches a display from progress/display and, if asked, an event log, and passes the Bus down in its context.Context, or has progress/cliprogress do so from its flags; an MCP server sends a tool call's progress with progress/mcpprogress, and a program reads back the event log it or a child wrote with progress/eventlog. A command built with cobra makes its tree strict about its command line with cobratree. The kit knows no program: a program's name, the noun for its targets and its rule for exit codes are parameters.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cliout writes the result of a command for a person and for a program: a Table in columns aligned by the columns a terminal gives its text, and JSON, every string in either made safe for a terminal.
|
Package cliout writes the result of a command for a person and for a program: a Table in columns aligned by the columns a terminal gives its text, and JSON, every string in either made safe for a terminal. |
|
Package cobratree makes a cobra command tree strict about its command line, marks the errors of a command line as usage errors, and reads what the Go toolchain recorded about the binary, for its version command.
|
Package cobratree makes a cobra command tree strict about its command line, marks the errors of a command line as usage errors, and reads what the Go toolchain recorded about the binary, for its version command. |
|
cobratreetest
Package cobratreetest runs a cobra command tree in a test, and checks the command lines a program's manual and help show against the tree.
|
Package cobratreetest runs a cobra command tree in a test, and checks the command lines a program's manual and help show against the tree. |
|
Package fanout works on many items at once, a bounded number at a time.
|
Package fanout works on many items at once, a bounded number at a time. |
|
fanouttest
Package fanouttest counts the calls a fake is in the middle of, so that a test can tell how many of them a fan-out ran at once: the requests a fake transport is asked to run, those a fake HTTP client sends to a service processor, the connections a scan dials.
|
Package fanouttest counts the calls a fake is in the middle of, so that a test can tell how many of them a fan-out ran at once: the requests a fake transport is asked to run, those a fake HTTP client sends to a service processor, the connections a scan dials. |
|
Package progress reports what a command is doing while it runs.
|
Package progress reports what a command is doing while it runs. |
|
cliprogress
Package cliprogress is the command line's side of progress: the words a flag such as --progress takes, the rule that picks a display from them and from what the program found out about its streams, and a Run, which makes the Bus, the display, the summary and the event log of one command and takes them down again, in order, once the command has ended.
|
Package cliprogress is the command line's side of progress: the words a flag such as --progress takes, the rule that picks a display from them and from what the program found out about its streams, and a Run, which makes the Bus, the display, the summary and the event log of one command and takes them down again, in order, once the command has ended. |
|
display
Package display shows the progress of a command on its standard error, from the events of its progress.Bus: the live tree, a few rows at the bottom of a terminal that show the work under way and what of it failed; the counter, one line there that says how far the work has got; plain lines, one for each thing worth a line, for a log as much as a terminal; and the summary a display leaves behind once the command has ended.
|
Package display shows the progress of a command on its standard error, from the events of its progress.Bus: the live tree, a few rows at the bottom of a terminal that show the work under way and what of it failed; the counter, one line there that says how far the work has got; plain lines, one for each thing worth a line, for a log as much as a terminal; and the summary a display leaves behind once the command has ended. |
|
eventlog
Package eventlog reads the event log that progress.Log writes, version 1 of the format doc/event-log.md describes: what a view of the runs a program made reads, and what a server reads back from a command it ran as a child, to send on the child's progress.
|
Package eventlog reads the event log that progress.Log writes, version 1 of the format doc/event-log.md describes: what a view of the runs a program made reads, and what a server reads back from a command it ran as a child, to send on the child's progress. |
|
mcpprogress
Package mcpprogress sends the progress of a call to an MCP tool, as the progress notifications of the Model Context Protocol: how many of the targets the call expects have ended, of how many, and a line for a person to read, such as "read the groups: 3/16 done, 1 failed".
|
Package mcpprogress sends the progress of a call to an MCP tool, as the progress notifications of the Model Context Protocol: how many of the targets the call expects have ended, of how many, and a line for a person to read, such as "read the groups: 3/16 done, 1 failed". |
|
progresstest
Package progresstest captures the progress events of a test, draws them as a tree that does not depend on the order concurrent work happened in, and checks that they keep the promises the progress package makes to every sink.
|
Package progresstest captures the progress events of a test, draws them as a tree that does not depend on the order concurrent work happened in, and checks that they keep the promises the progress package makes to every sink. |
|
Package termtext makes untrusted text safe to write to a terminal, and measures how many columns text takes there and fills text to a number of them.
|
Package termtext makes untrusted text safe to write to a terminal, and measures how many columns text takes there and fills text to a number of them. |