Add initial distributor CLI skeleton

This commit is contained in:
2026-05-31 01:47:39 +00:00
parent 0818733b19
commit 22d0424232
19 changed files with 436 additions and 2 deletions

14
internal/app/app.go Normal file
View File

@@ -0,0 +1,14 @@
package app
import "errors"
const Name = "distributor"
// Version can be replaced at build time with -ldflags "-X .../internal/app.Version=<value>".
var Version = "dev"
var ErrNotImplemented = errors.New("not implemented")
func VersionString() string {
return Name + " " + Version
}

16
internal/app/app_test.go Normal file
View File

@@ -0,0 +1,16 @@
package app
import "testing"
func TestVersionString(t *testing.T) {
oldVersion := Version
t.Cleanup(func() {
Version = oldVersion
})
Version = "1.2.3"
if got, want := VersionString(), "distributor 1.2.3"; got != want {
t.Fatalf("VersionString() = %q, want %q", got, want)
}
}

14
internal/app/inspect.go Normal file
View File

@@ -0,0 +1,14 @@
package app
import (
"context"
"fmt"
)
type InspectOptions struct {
Path string
}
func Inspect(context.Context, InspectOptions) error {
return fmt.Errorf("inspect command: %w", ErrNotImplemented)
}

5
internal/app/pipeline.go Normal file
View File

@@ -0,0 +1,5 @@
package app
type Pipeline struct {
ID string
}

12
internal/app/run.go Normal file
View File

@@ -0,0 +1,12 @@
package app
import (
"context"
"fmt"
)
type RunOptions struct{}
func Run(context.Context, RunOptions) error {
return fmt.Errorf("run command: %w", ErrNotImplemented)
}

14
internal/app/validate.go Normal file
View File

@@ -0,0 +1,14 @@
package app
import (
"context"
"fmt"
)
type ValidateOptions struct {
Path string
}
func Validate(context.Context, ValidateOptions) error {
return fmt.Errorf("validate command: %w", ErrNotImplemented)
}