Add initial distributor CLI skeleton
This commit is contained in:
14
internal/app/app.go
Normal file
14
internal/app/app.go
Normal 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
16
internal/app/app_test.go
Normal 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
14
internal/app/inspect.go
Normal 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
5
internal/app/pipeline.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package app
|
||||
|
||||
type Pipeline struct {
|
||||
ID string
|
||||
}
|
||||
12
internal/app/run.go
Normal file
12
internal/app/run.go
Normal 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
14
internal/app/validate.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user