Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Commit

Permalink
Add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
deslaughter committed May 9, 2024
1 parent 1848352 commit 7121957
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
6 changes: 1 addition & 5 deletions frontend/src/components/MainNav.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,7 @@ onMounted(() => { })
<router-link class="nav-link" to="/results">Results</router-link>
</li>
</ul>
<span class="navbar-text me-2" v-if="project.status.project == LOADING">
<div class="spinner-border spinner-border-sm text-light" role="status">
<span class="visually-hidden">Saving...</span>
</div>
</span>
<span class="navbar-text">{{ project.info?.Version }}</span>
</div>
</div>
</nav>
Expand Down
2 changes: 2 additions & 0 deletions frontend/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1280,6 +1280,7 @@ export namespace main {
export class Info {
Date: string;
Path: string;
Version: string;

static createFrom(source: any = {}) {
return new Info(source);
Expand All @@ -1289,6 +1290,7 @@ export namespace main {
if ('string' === typeof source) source = JSON.parse(source);
this.Date = source["Date"];
this.Path = source["Path"];
this.Version = source["Version"];
}
}

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.21

require (
github.com/adrg/xdg v0.4.0
github.com/carlmjohnson/versioninfo v0.22.5
github.com/dominikbraun/graph v0.23.0
github.com/labstack/gommon v0.4.2
github.com/mkmik/argsort v1.1.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
github.com/carlmjohnson/versioninfo v0.22.5 h1:O00sjOLUAFxYQjlN/bzYTuZiS0y6fWDQjMRvwtKgwwc=
github.com/carlmjohnson/versioninfo v0.22.5/go.mod h1:QT9mph3wcVfISUKd0i9sZfVrPviHuSF+cUtLjm2WSf8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flag"
"fmt"

"github.com/carlmjohnson/versioninfo"
"github.com/labstack/gommon/log"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
Expand All @@ -15,12 +16,14 @@ import (
//go:embed all:frontend/dist
var assets embed.FS

var version = "0.2.0-" + versioninfo.Short()

func main() {

showVersion := flag.Bool("version", false, "display version information")
flag.Parse()
if *showVersion {
fmt.Println("v0.1.0-alpha")
fmt.Println(version)
return
}

Expand Down
6 changes: 4 additions & 2 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ type Project struct {
}

type Info struct {
Date string `json:"Date"`
Path string `json:"Path"`
Date string `json:"Date"`
Path string `json:"Path"`
Version string `json:"Version"`
}

func NewProject() *Project {
Expand All @@ -46,6 +47,7 @@ func LoadProject(path string) (*Project, error) {

// Save project path
p.Info.Path = path
p.Info.Version = version

return p, nil
}
Expand Down

0 comments on commit 7121957

Please sign in to comment.