diff --git a/main.go b/main.go index aaf47fcf..80c8bf06 100644 --- a/main.go +++ b/main.go @@ -6,6 +6,7 @@ import ( "io" "os" "os/exec" + "path/filepath" "runtime/pprof" "strings" "syscall" @@ -74,6 +75,13 @@ var ( if path, err := exec.LookPath("k3-" + args[0]); err == nil { return proc.Exec(path, args[1:]...) } + conf, err := project.NewConfig(project.WithK3()) + if err != nil { + return fmt.Errorf("unknown command: %w", err) + } + if path, err := exec.LookPath(filepath.Join(conf.K3.Root, "libexec", "ntt-"+args[0])); err == nil { + return proc.Exec(path, args[1:]...) + } return fmt.Errorf("unknown command: %s", args[0]) } diff --git a/project/internal/k3/k3.go b/project/internal/k3/k3.go index 51d5d9c1..abec10d8 100644 --- a/project/internal/k3/k3.go +++ b/project/internal/k3/k3.go @@ -28,7 +28,7 @@ import ( var ErrNotFound = errors.New("not found") type Instance struct { - root string + Root string Compiler string Runtime string @@ -169,7 +169,7 @@ func getInstall(ctx context.Context, prefix string) (*Instance, error) { defer region.End() log.Tracef(ctx, "k3", "get install: %s\n", prefix) - k := Instance{root: prefix} + k := Instance{Root: prefix} if k3c := env.Getenv("K3C"); k3c != "" { k.Compiler = k3c @@ -234,7 +234,7 @@ func getRepo(ctx context.Context, k3SourceDir, k3BinaryDir, mtcBinaryDir string) defer region.End() log.Tracef(ctx, "k3", "get repo: %s %s %s\n", k3SourceDir, k3BinaryDir, mtcBinaryDir) - k := Instance{root: k3BinaryDir} + k := Instance{Root: k3BinaryDir} if k3c := env.Getenv("K3C"); k3c != "" { k.Compiler = k3c diff --git a/project/project.go b/project/project.go index ccd7b96e..1a29e88d 100644 --- a/project/project.go +++ b/project/project.go @@ -65,9 +65,6 @@ type Config struct { ResultsFile string `json:"results_file"` K3 struct { - // K3 root folder - Root string `json:",omitempty"` - k3.Instance `json:",inline"` // T3XF is the path to the T3XF file.