32 lines
559 B
Go
32 lines
559 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"ollie/tools/codeintel/internal/codeintel"
|
|
"os"
|
|
"path/filepath"
|
|
)
|
|
|
|
func main() {
|
|
var a struct {
|
|
Path string `json:"path"`
|
|
Language string `json:"language"`
|
|
}
|
|
if err := json.NewDecoder(os.Stdin).Decode(&a); err != nil {
|
|
fail(err)
|
|
}
|
|
p, err := filepath.Abs(a.Path)
|
|
if err != nil {
|
|
fail(err)
|
|
}
|
|
ds, err := codeintel.Dependencies(p, a.Language)
|
|
if err != nil {
|
|
fail(err)
|
|
}
|
|
for _, d := range ds {
|
|
fmt.Println(d)
|
|
}
|
|
}
|
|
func fail(e error) { fmt.Fprintln(os.Stderr, "error:", e); os.Exit(1) }
|