Initial implementation of pluginctl CLI tool
- Add comprehensive info command with plugin manifest parsing - Implement global --plugin-path flag and PLUGINCTL_PLUGIN_PATH env var - Add full test suite with fixtures for various plugin configurations - Set up build system with Makefile, goreleaser, and golangci-lint - Include development tools with pinned versions for reproducible builds 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
commit
fd6e4a4513
21 changed files with 4949 additions and 0 deletions
40
version.go
Normal file
40
version.go
Normal file
|
@ -0,0 +1,40 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
// RunVersionCommand implements the 'version' command functionality.
|
||||
func RunVersionCommand(args []string) error {
|
||||
version := getVersion()
|
||||
fmt.Printf("pluginctl version %s\n", version)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// getVersion returns the version information from build info.
|
||||
func getVersion() string {
|
||||
info, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return "unknown"
|
||||
}
|
||||
|
||||
// First try to get version from main module
|
||||
if info.Main.Version != "" && info.Main.Version != "(devel)" {
|
||||
return info.Main.Version
|
||||
}
|
||||
|
||||
// Look for version in build settings (set by goreleaser)
|
||||
for _, setting := range info.Settings {
|
||||
if setting.Key == "vcs.revision" {
|
||||
// Return short commit hash if no version tag
|
||||
if len(setting.Value) >= 7 {
|
||||
return setting.Value[:7]
|
||||
}
|
||||
return setting.Value
|
||||
}
|
||||
}
|
||||
|
||||
return "dev"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue