feat: add netssh version and --version
`netssh --version` used to be passed to ssh and failed with "unknown option -- -". Release builds now embed the tag via -X main.version; other builds fall back to the module build info. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2b46c4f74d
commit
786768ec53
3 files changed
+40
-2
No files matched your search
+6
-1
@@ -40,6 +40,7 @@ var managedSubcommands = map[string]bool{
|
||||
"completion": true,
|
||||
"__complete": true,
|
||||
"help": true,
|
||||
"version": true,
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -49,6 +50,10 @@ func main() {
|
||||
runTUI()
|
||||
return
|
||||
}
|
||||
if args[0] == "--version" {
|
||||
fmt.Printf("netssh %s\n", buildVersion())
|
||||
return
|
||||
}
|
||||
|
||||
if managedSubcommands[args[0]] {
|
||||
if err := rootCmd().Execute(); err != nil {
|
||||
@@ -352,7 +357,7 @@ func rootCmd() *cobra.Command {
|
||||
},
|
||||
}
|
||||
|
||||
root.AddCommand(notesCmd(), configureCmd(), searchCmd(), cacheCmd(), aliasCmd(), hookCmd(), shellInitCmd())
|
||||
root.AddCommand(notesCmd(), configureCmd(), searchCmd(), cacheCmd(), aliasCmd(), hookCmd(), shellInitCmd(), versionCmd())
|
||||
|
||||
// cobra builds the "completion" command lazily; force init so we can extend it.
|
||||
root.InitDefaultCompletionCmd()
|
||||
|
||||
Reference in new issue
Block a user