Skip to content

Commit

Permalink
feat: switch version
Browse files Browse the repository at this point in the history
  • Loading branch information
MJECloud authored and JanDeDobbeleer committed Nov 20, 2020
1 parent 4fa9f01 commit 45b50fb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions main.go
Expand Up @@ -7,13 +7,16 @@ import (
"fmt"
)

var currentVersion = "development"

type args struct {
ErrorCode *int
PrintConfig *bool
PrintShell *bool
Config *string
Shell *string
PWD *string
Version *bool
Debug *bool
}

Expand Down Expand Up @@ -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,
Expand All @@ -62,6 +69,10 @@ func main() {
fmt.Println(env.getShellName())
return
}
if *args.Version {
fmt.Println(currentVersion)
return
}
colorWriter := &Renderer{
Buffer: new(bytes.Buffer),
}
Expand Down

0 comments on commit 45b50fb

Please sign in to comment.