diff --git a/.gitignore b/.gitignore index 9b1c8b1..b823fe9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /dist +/src/manifest.json diff --git a/manifest.json b/manifest.json index 23efdfb..fa44f96 100644 --- a/manifest.json +++ b/manifest.json @@ -1,3 +1,5 @@ { + "name": "nvrh", + "shortDescription": "A remote helper for neovim", "version": "0.1.5" } diff --git a/script/build b/script/build index 77f9062..7ef1324 100755 --- a/script/build +++ b/script/build @@ -4,6 +4,8 @@ set -ex ARCHS=(amd64 arm64) OSES=(linux darwin windows) +cp manifest.json src/ + for os in "${OSES[@]}"; do for arch in "${ARCHS[@]}"; do GOOS="$os" GOARCH="$arch" go build -o "dist/$(basename "$PWD")-$os-$arch" ./src/main.go diff --git a/src/main.go b/src/main.go index 2752a71..a541a62 100644 --- a/src/main.go +++ b/src/main.go @@ -1,6 +1,8 @@ package main import ( + _ "embed" + "encoding/json" "log" "os" @@ -9,10 +11,27 @@ import ( "nvrh/src/client" ) +//go:embed manifest.json +var manifestData []byte + +type Manifest struct { + Name string `json:"name"` + Version string `json:"version"` + ShortDescription string `json:"shortDescription"` +} + func main() { + var manifest Manifest + if err := json.Unmarshal(manifestData, &manifest); err != nil { + log.Fatalf("Error reading manifest: %v", err) + } + app := &cli.App{ - Name: "nvrh", - Usage: "Helps work with a remote nvim instance", + Name: manifest.Name, + // These fields are named kind of strange. The `Usage` field is paired with + // the `Name` when running `--help`. + Usage: manifest.ShortDescription, + Version: manifest.Version, Commands: []*cli.Command{ &client.CliClientCommand,