Skip to content

Instantly share code, notes, and snippets.

@haroldadmin
Created July 3, 2020 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haroldadmin/73dc2ca674aaf566c02fe66109b2f859 to your computer and use it in GitHub Desktop.
Save haroldadmin/73dc2ca674aaf566c02fe66109b2f859 to your computer and use it in GitHub Desktop.
A small app written using Fyne to show the current PATH value
package main
import (
"fmt"
"os"
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/widget"
"github.com/haroldadmin/pathfix"
)
func main() {
app := app.New()
w := app.NewWindow("PATH Demo")
w.Resize(fyne.NewSize(800, 300))
path := os.Getenv("PATH")
label := widget.NewLabel(path)
label.Wrapping = fyne.TextWrapBreak
w.SetContent(widget.NewVBox(
label,
widget.NewButton("Refresh", func() {
err := pathfix.Fix()
if err != nil {
fmt.Println(err)
}
newPath := os.Getenv("PATH")
label.Text = newPath
label.Refresh()
}),
))
w.ShowAndRun()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment