Advertise framework inspection commands in usage
This commit is contained in:
@@ -746,5 +746,6 @@ func printUsage(w io.Writer) {
|
||||
fmt.Fprintf(w, " serve: scriptorium serve [--config PATH] [--config-overlay NAME] [--promptkit-source PATH ...] [--addr %s] [--schema-dir DIR] [--artifact-root DIR] [--max-request-bytes N] [--max-artifact-bytes N] [--max-response-bytes N]\n", defaults.HTTPAddrDefault)
|
||||
fmt.Fprintln(w, " inspect prompt: scriptorium inspect prompt --prompt ID [--prompt-version VERSION] [--config PATH] [--config-overlay NAME] [--promptkit-source PATH ...] [--schema-dir DIR] [--format text|json] [--out path]")
|
||||
fmt.Fprintln(w, " inspect profile: scriptorium inspect profile --profile ID [--config PATH] [--config-overlay NAME] [--promptkit-source PATH ...] [--schema-dir DIR] [--format text|json] [--out path]")
|
||||
fmt.Fprintln(w, " inspect configuration: scriptorium inspect configuration <validate|show|sources|explain> [--config PATH] [--config-overlay NAME] [--promptkit-source PATH ...] [--schema-dir DIR] [--path JSON_POINTER (required for explain)]")
|
||||
fmt.Fprintln(w, " config: scriptorium config <validate|show|sources|explain> [--config PATH] [--config-overlay NAME] [application overrides] [--path /pointer for explain]")
|
||||
}
|
||||
|
||||
@@ -251,6 +251,32 @@ func TestParseServeArgsRejectsRuntimeOverrideFlags(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsageAdvertisesFrameworkConfigurationInspection(t *testing.T) {
|
||||
code, stdout, usage := runCLICommand(t, Run, nil)
|
||||
if code != ExitRuntimeError || stdout != "" {
|
||||
t.Fatalf("usage exit/streams changed: code=%d stdout=%q", code, stdout)
|
||||
}
|
||||
|
||||
var frameworkUsage string
|
||||
for _, line := range strings.Split(usage, "\n") {
|
||||
if strings.Contains(line, "inspect configuration") {
|
||||
frameworkUsage = line
|
||||
break
|
||||
}
|
||||
}
|
||||
if frameworkUsage == "" {
|
||||
t.Fatalf("usage omits framework configuration inspection: %s", usage)
|
||||
}
|
||||
for _, want := range []string{
|
||||
"validate", "show", "sources", "explain",
|
||||
"--config", "--config-overlay", "--promptkit-source", "--schema-dir", "--path",
|
||||
} {
|
||||
if !strings.Contains(frameworkUsage, want) {
|
||||
t.Errorf("framework configuration usage omits %q: %s", want, frameworkUsage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestUsageIncludesExecutionAndServeFlags(t *testing.T) {
|
||||
var stderr bytes.Buffer
|
||||
code := Run(nil, io.Discard, &stderr)
|
||||
|
||||
Reference in New Issue
Block a user