Skip to content

Commit

Permalink
show current version
Browse files Browse the repository at this point in the history
  • Loading branch information
arguablykomodo committed Jun 1, 2019
1 parent 66a0d2b commit 05151e2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ for I in ${!OSLIST[*]}; do
OUT=${OUT}.exe
fi

go build -o $OUT
go build -o $OUT -ldflags "-X main.tag=$(git describe)"
done
done
7 changes: 7 additions & 0 deletions cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package main

import (
"flag"
"fmt"
)

func cli() {
paths, names := getProfilePaths()

version := flag.Bool("version", false, "Shows the current version")
uninstalling := flag.Bool("uninstall", false, "Wheter to install or uninstall ShadowFox")
profileName := flag.String("profile-name", "", "Name of profile to use, if not defined or not found will fallback to profile-index")
profileIndex := flag.Int("profile-index", 0, "Index of profile to use")
Expand All @@ -15,6 +17,11 @@ func cli() {

flag.Parse()

if *version {
fmt.Println(header)
return
}

var path string
for i, name := range names {
if name == *profileName {
Expand Down
2 changes: 2 additions & 0 deletions fallback.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
)

func createFallbackUI() {
fmt.Println(header)

var choice string
paths, names := getProfilePaths()

Expand Down
3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"os"
)

var tag string
var header = "Shadowfox updater " + tag

func main() {
if len(os.Args) > 1 {
cli()
Expand Down
18 changes: 9 additions & 9 deletions ui.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ import (

func checkErr(msg string, err error) {
if err != nil {
dlgs.Error("Shadowfox Updater", msg+"\n"+err.Error())
dlgs.Error(header, msg+"\n"+err.Error())
panic(err)
}
}

func createUI() error {
paths, names := getProfilePaths()

name, selected, err := dlgs.List("Shadowfox Updater", "Which Firefox profile are you going to use?", names)
name, selected, err := dlgs.List(header, "Which Firefox profile are you going to use?", names)
if err != nil {
return err
}

if !selected {
_, err := dlgs.Info("Shadowfox Updater", "You didn't pick any profile, the application will now close.")
_, err := dlgs.Info(header, "You didn't pick any profile, the application will now close.")
if err != nil {
return err
}
Expand All @@ -36,30 +36,30 @@ func createUI() error {
}
profilePath := paths[pathIndex]

action, selected, err := dlgs.List("Shadowfox Updater", "What do you want to do?", []string{"Install/Update Shadowfox", "Uninstall Shadowfox"})
action, selected, err := dlgs.List(header, "What do you want to do?", []string{"Install/Update Shadowfox", "Uninstall Shadowfox"})
if err != nil {
return err
}

if !selected {
dlgs.Info("Shadowfox Updater", "You didn't pick any action, the application will now close.")
dlgs.Info(header, "You didn't pick any action, the application will now close.")
return nil
}

if action == "Install/Update Shadowfox" {
shouldGenerateUUIDs, err := dlgs.Question("Shadowfox Updater", "Would you like to auto-generate UUIDs?", true)
shouldGenerateUUIDs, err := dlgs.Question(header, "Would you like to auto-generate UUIDs?", true)
if err != nil {
return err
}

shouldSetTheme, err := dlgs.Question("Shadowfox Updater", "Would you like to automatically set the Firefox dark theme?", false)
shouldSetTheme, err := dlgs.Question(header, "Would you like to automatically set the Firefox dark theme?", false)
if err != nil {
return err
}

msg, err := install(profilePath, shouldGenerateUUIDs, shouldSetTheme)
if err == nil {
_, err = dlgs.Info("Shadowfox Updater", "Shadowfox has been succesfully installed!")
_, err = dlgs.Info(header, "Shadowfox has been succesfully installed!")
if err != nil {
return err
}
Expand All @@ -69,7 +69,7 @@ func createUI() error {
} else {
msg, err := uninstall(profilePath)
if err == nil {
_, err = dlgs.Info("Shadowfox Updater", "Shadowfox has been succesfully uninstalled!")
_, err = dlgs.Info(header, "Shadowfox has been succesfully uninstalled!")
if err != nil {
return err
}
Expand Down

0 comments on commit 05151e2

Please sign in to comment.