diff --git a/cmd/mesh-controller/main.go b/cmd/mesh-controller/main.go index 1bc06227..4382d52a 100644 --- a/cmd/mesh-controller/main.go +++ b/cmd/mesh-controller/main.go @@ -237,8 +237,8 @@ func run() error { } } -func usage() { - fmt.Fprint(os.Stderr, `mesh-controller — the control plane +// usageText is the terminal's help: every command it has, and none it refuses as removed (removedByName). +var usageText = `mesh-controller — the control plane On a node the operator types these as 'mesh-cli ' (in zsh, 'nox '): asked through the node's engine, and run as the controller's terminal only on the control-node @@ -312,15 +312,14 @@ func usage() { operator key make [--out ] make the operator's sealing key, off the mesh; private half to the file only operator key set [--replace] tell the mesh which operator key to seal to operator key show the operator key, and what it can recover - build [--ref R] have a build machine build it, and record what came out - build --behind build every module the mesh holds older than its source - build --on rebuild every module that stands on this module's artifacts, bases first + register / register a module from a repository the catalogue does not + build, from the builder's done key of its fingerprint (ADR 0501 §4) + switch [--json] the switch's list: each module, the build it runs, and what the builder holds builds [] what has been built lately, and what came of it queue [--json] every ask in the build queue: waiting, in flight (where, how long), dead cancel drop a waiting or dead ask; recorded failed, cancelled by hand clear [--dead] cancel every waiting ask (and the dead ones); never one in flight - rebuild ask the module's source again, or that build's, under a new id - replay [--register [--older]] that build's commit again; a dry run unless --register + replay that build's commit again, a dry run: what a build of it makes kill end a build where it runs; recorded failed, killed by hand pause [] / resume [] the build seat's holder there, or every holder, takes nothing new / again plans retry ask a failed plan's failed builds again, and carry the plan on @@ -355,10 +354,13 @@ func usage() { version what this binary is Each context reaches its own store through its own credential (novox/hq ADR 0008), named -`+store.Variable("")+` — or `+store.FileVariable("")+`, naming a file that holds +` + store.Variable("") + ` — or ` + store.FileVariable("") + `, naming a file that holds the same thing and keeps the password out of the environment. This process holds: -`) +` + +func usage() { + fmt.Fprint(os.Stderr, usageText) for _, c := range held { fmt.Fprintf(os.Stderr, " %-12s database %-12s from %s\n", c.name, store.Database(c.name), store.Variable(c.name)) diff --git a/cmd/mesh-controller/usage_test.go b/cmd/mesh-controller/usage_test.go new file mode 100644 index 00000000..3dd8a0c9 --- /dev/null +++ b/cmd/mesh-controller/usage_test.go @@ -0,0 +1,25 @@ +package main + +import ( + "regexp" + "strings" + "testing" +) + +// C3 (issue 1851 A11a, A11b, A13; ADR 0501 §4, §5): the terminal's help lists no command it refuses as removed, and lists +// the ones R4e added: `register` and `switch`. +func TestTheHelpListsNoRemovedCommandAndTheNewOnes(t *testing.T) { + for _, removed := range []string{"build", "rebuild", "forget-checks", "delivery plan"} { + if regexp.MustCompile(`(?m)^ `+regexp.QuoteMeta(removed)+` `).MatchString(usageText) { + t.Errorf("the help still lists %q, which is refused as removed", removed) + } + } + if strings.Contains(usageText, "--register") { + t.Error("the help still lists replay --register, which is refused as removed") + } + for _, added := range []string{"register / ", "switch [--json]"} { + if !strings.Contains(usageText, " "+added) { + t.Errorf("the help does not list %q", added) + } + } +}