mirror of
https://github.com/elyby/chrly.git
synced 2024-12-23 13:40:11 +05:30
Resolves #21. Print hostname in the version command output
This commit is contained in:
parent
15c6816813
commit
dbefac0e84
@ -5,6 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased] - xxxx-xx-xx
|
## [Unreleased] - xxxx-xx-xx
|
||||||
|
### Added
|
||||||
|
- [#20](https://github.com/elyby/chrly/issues/20): Print hostname in the `version` command output.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- [#22](https://github.com/elyby/chrly/issues/22): Correct version passing during building of the Docker image.
|
- [#22](https://github.com/elyby/chrly/issues/22): Correct version passing during building of the Docker image.
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package cmd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
@ -13,10 +14,16 @@ var versionCmd = &cobra.Command{
|
|||||||
Use: "version",
|
Use: "version",
|
||||||
Short: "Show the Chrly version information",
|
Short: "Show the Chrly version information",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
hostname, err := os.Hostname()
|
||||||
|
if err != nil {
|
||||||
|
hostname = "<unknown>"
|
||||||
|
}
|
||||||
|
|
||||||
fmt.Printf("Version: %s\n", version.Version())
|
fmt.Printf("Version: %s\n", version.Version())
|
||||||
fmt.Printf("Commit: %s\n", version.Commit())
|
fmt.Printf("Commit: %s\n", version.Commit())
|
||||||
fmt.Printf("Go version: %s\n", runtime.Version())
|
fmt.Printf("Go version: %s\n", runtime.Version())
|
||||||
fmt.Printf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
fmt.Printf("OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
|
||||||
|
fmt.Printf("Hostname: %s\n", hostname)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user