mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-27 02:51:44 -08:00
feat: switch version
This commit is contained in:
parent
4fa9f01653
commit
45b50fba3b
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -68,7 +68,7 @@ jobs:
|
|||
uses: actions/checkout@v2
|
||||
- name: Build
|
||||
id: build
|
||||
run: go build -o ${{ matrix.ARTIFACT }}
|
||||
run: go build -o ${{ matrix.ARTIFACT }} -ldflags="-X 'main.version= ${{ needs.release.outputs.version }}'"
|
||||
env:
|
||||
GOARCH: "amd64"
|
||||
- name: Hash
|
||||
|
|
11
main.go
11
main.go
|
@ -7,6 +7,8 @@ import (
|
|||
"fmt"
|
||||
)
|
||||
|
||||
var currentVersion = "development"
|
||||
|
||||
type args struct {
|
||||
ErrorCode *int
|
||||
PrintConfig *bool
|
||||
|
@ -14,6 +16,7 @@ type args struct {
|
|||
Config *string
|
||||
Shell *string
|
||||
PWD *string
|
||||
Version *bool
|
||||
Debug *bool
|
||||
}
|
||||
|
||||
|
@ -43,6 +46,10 @@ func main() {
|
|||
"pwd",
|
||||
"",
|
||||
"the path you are working in"),
|
||||
Version: flag.Bool(
|
||||
"version",
|
||||
false,
|
||||
"Print the current version of the binary"),
|
||||
Debug: flag.Bool(
|
||||
"debug",
|
||||
false,
|
||||
|
@ -62,6 +69,10 @@ func main() {
|
|||
fmt.Println(env.getShellName())
|
||||
return
|
||||
}
|
||||
if *args.Version {
|
||||
fmt.Println(currentVersion)
|
||||
return
|
||||
}
|
||||
colorWriter := &Renderer{
|
||||
Buffer: new(bytes.Buffer),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue