mirror of
https://github.com/juanfont/headscale.git
synced 2026-02-07 20:04:00 +01:00
Convert the 10 commands that were still using Run with ErrorOutput/SuccessOutput or log.Fatal/os.Exit: - backfillNodeIPsCmd: use grpcRunE-style manual connection with error returns; simplify the confirm/force logic - getPolicy, setPolicy, checkPolicy: replace ErrorOutput with fmt.Errorf returns in both the bypass-gRPC and gRPC paths - serveCmd, configTestCmd: replace log.Fatal with error returns - mockOidcCmd: replace log.Error+os.Exit with error return - versionCmd, generatePrivateKeyCmd: replace SuccessOutput with printOutput - dumpConfigCmd: return the error instead of swallowing it
23 lines
531 B
Go
23 lines
531 B
Go
package cli
|
|
|
|
import (
|
|
"github.com/juanfont/headscale/hscontrol/types"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
versionCmd.Flags().StringP("output", "o", "", "Output format. Empty for human-readable, 'json', 'json-line' or 'yaml'")
|
|
}
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print the version.",
|
|
Long: "The version of headscale.",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
info := types.GetVersionInfo()
|
|
|
|
return printOutput(cmd, info, info.String())
|
|
},
|
|
}
|