Add initial distributor CLI skeleton
This commit is contained in:
32
internal/cli/run.go
Normal file
32
internal/cli/run.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"gitea.maximumdirect.net/eric/distributor/internal/app"
|
||||
)
|
||||
|
||||
func runCommand(ctx context.Context, args []string, stdout, stderr io.Writer) int {
|
||||
if hasHelp(args) {
|
||||
printRunHelp(stdout)
|
||||
return exitOK
|
||||
}
|
||||
if len(args) > 0 {
|
||||
fmt.Fprintf(stderr, "%s: run does not accept options yet: %v\n", app.Name, args)
|
||||
return exitUsage
|
||||
}
|
||||
if err := app.Run(ctx, app.RunOptions{}); err != nil {
|
||||
return fail(stderr, err)
|
||||
}
|
||||
return exitOK
|
||||
}
|
||||
|
||||
func printRunHelp(w io.Writer) {
|
||||
fmt.Fprint(w, `Usage:
|
||||
distributor run
|
||||
|
||||
The run command is present but distribution behavior is not implemented yet.
|
||||
`)
|
||||
}
|
||||
Reference in New Issue
Block a user