Skip to content

Commit

Permalink
vinegar.go: fixed broken gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lunarlattice0 committed Oct 17, 2023
1 parent 8d9d684 commit 1f4b209
Showing 1 changed file with 41 additions and 43 deletions.
84 changes: 41 additions & 43 deletions cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,67 +39,65 @@ func main() {

switch cmd {
// These commands don't require a configuration
case "delete", "edit", "uninstall", "reportinfo":
case "delete", "edit", "uninstall":
switch cmd {
case "delete":
Delete()
case "edit":
editor.EditConfig(*configPath)
case "uninstall":
Uninstall()
// These commands (except player & studio) don't require a configuration,
// but they require a wineprefix, hence wineroot of configuration is required.
case "player", "studio", "exec", "kill", "install-webview2", "winetricks":
pfxKilled := false
cfg, err := config.Load(*configPath)
if err != nil {
log.Fatal(err)
}

pfx := wine.New(dirs.Prefix)
// Always ensure its created, wine will complain if the root
// directory doesnt exist
if err := os.MkdirAll(dirs.Prefix, 0o755); err != nil {
log.Fatal(err)
}

c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)
}
// These commands (except player & studio) don't require a configuration,
// but they require a wineprefix, hence wineroot of configuration is required.
case "player", "studio", "exec", "kill", "install-webview2", "winetricks":
pfxKilled := false
cfg, err := config.Load(*configPath)
if err != nil {
log.Fatal(err)
}

go func() {
<-c
pfxKilled = true
pfx.Kill()
pfx := wine.New(dirs.Prefix)
// Always ensure its created, wine will complain if the root
// directory doesnt exist
if err := os.MkdirAll(dirs.Prefix, 0o755); err != nil {
log.Fatal(err)
}

if pfxKilled {
os.Exit(0)
}
}()
c := make(chan os.Signal, 1)
signal.Notify(c, syscall.SIGTERM, syscall.SIGINT)

switch cmd {
case "exec":
if len(args) < 2 {
usage()
}
go func() {
<-c
pfxKilled = true
pfx.Kill()

if err := pfx.Wine(args[1], args[2:]...).Run(); err != nil {
log.Fatal(err)
}
case "kill":
pfx.Kill()
if pfxKilled {
os.Exit(0)
}
}()

case "reportinfo":
if report, err := util.GenerateInfo(*configPath); err != nil {
log.Fatal(err) // you have REALLY screwed up now
}
fmt.Println("Please share the information below.")
fmt.Printf("%+v\n", report)
switch cmd {
case "exec":
if len(args) < 2 {
usage()
}

if err := pfx.Wine(args[1], args[2:]...).Run(); err != nil {
log.Fatal(err)
}
case "kill":
pfx.Kill()
case "install-webview2":
if err := InstallWebview2(&pfx); err != nil {
log.Fatal(err)
}
case "reportinfo":
if report, err := util.GenerateInfo(*configPath); err != nil {
log.Fatal(err)
}
fmt.Println("Please share the information below.")
fmt.Printf("%+v\n", report)
case "winetricks":
if err := pfx.Winetricks(); err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 1f4b209

Please sign in to comment.