37 lines
720 B
Go
37 lines
720 B
Go
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
|
|
}
|
|
if len(args) > 1 {
|
|
fmt.Fprintf(stderr, "%s: inspect accepts at most one path\n", app.Name)
|
|
return exitUsage
|
|
}
|
|
var path string
|
|
if len(args) == 1 {
|
|
path = args[0]
|
|
}
|
|
if err := app.Inspect(ctx, app.InspectOptions{Path: path, Stdout: stdout}); err != nil {
|
|
return fail(stderr, err)
|
|
}
|
|
return exitOK
|
|
}
|
|
|
|
func printInspectHelp(w io.Writer) {
|
|
fmt.Fprint(w, `Usage:
|
|
distributor inspect <path>
|
|
|
|
Print a normalized summary of local source bundles.
|
|
`)
|
|
}
|