Files

48 lines
1.2 KiB
Go
Raw Permalink Normal View History

2026-05-31 01:47:39 +00:00
package cli
import (
"context"
"fmt"
"io"
"gitea.maximumdirect.net/eric/distributor/internal/app"
)
func inspectCommand(ctx context.Context, args []string, stdout, stderr io.Writer) int {
if hasHelp(args) {
printInspectHelp(stdout)
return exitOK
}
2026-06-02 18:40:17 +00:00
parsed, ok := parseSourceDiagnosticArgs(stderr, "inspect", args)
if !ok {
return exitUsage
}
if err := app.Inspect(ctx, app.InspectOptions{
2026-06-02 18:40:17 +00:00
Path: parsed.Path,
ConfigPath: parsed.ConfigPath,
PipelineID: parsed.PipelineID,
BundlePath: parsed.BundlePath,
Stdout: stdout,
2026-06-02 18:40:17 +00:00
OutputFormat: parsed.OutputFormat,
}); err != nil {
2026-05-31 01:47:39 +00:00
return fail(stderr, err)
}
return exitOK
}
func printInspectHelp(w io.Writer) {
fmt.Fprint(w, `Usage:
distributor inspect [--format text|json] <path>
distributor inspect --config <path> --pipeline <id> [--bundle <path>] [--format text|json]
Options:
--config <path> Path to config file for configured source inspection
--pipeline <id> Pipeline id to inspect in config mode
--bundle <path> Source-root-relative bundle path to inspect
--format text|json Output format
2026-05-31 01:47:39 +00:00
Print a normalized summary of local source bundles or a configured pipeline
source.
2026-05-31 01:47:39 +00:00
`)
}