3 Commits

Author SHA1 Message Date
882413fb1e 1.0.7 2025-07-12 05:51:33 -07:00
2cdeeef5b4 fix mac issues 2025-07-12 05:51:07 -07:00
afb8457489 fix spacing 2025-07-12 05:29:58 -07:00
3 changed files with 27 additions and 16 deletions

View File

@ -1,6 +1,7 @@
package main
import (
"bufio"
"fmt"
"github.com/BurntSushi/toml"
"os"
@ -22,7 +23,10 @@ const (
configName = "config.toml"
)
var cfgPath string
var (
configRun = false
cfgPath string
)
func setupConfig(rerun bool) (*Config, error) {
home, err := os.UserHomeDir()
@ -39,13 +43,13 @@ func setupConfig(rerun bool) (*Config, error) {
_, statErr := os.Stat(cfgPath)
if rerun || os.IsNotExist(statErr) {
configRun = true
fmt.Println("Enter the path to your Wow directory below. Use the full path without shortcuts like '~' (ex: /home/user/epoch):")
var s string
_, err = fmt.Scanln(&s)
s, err := readLine()
if err != nil {
return nil, fmt.Errorf("unable to read input: %v", err)
}
newConfig.WowDir = strings.TrimSpace(s)
newConfig.WowDir = s
fmt.Println()
p, err := promptYesNo(fmt.Sprintf("Do you want to use epochcli to launch Wow? Select No if you plan on using a launcher tool like Lutris (y/n): "))
@ -81,7 +85,7 @@ func setupConfig(rerun bool) (*Config, error) {
if s == "" {
fmt.Printf("wine %s\n", newConfig.LaunchCmd)
} else {
fmt.Printf("WINEPREFIX=%s wine %s\n", newConfig.WinePrefix, newConfig.LaunchCmd)
fmt.Printf("WINEPREFIX=%s %s\n", newConfig.WinePrefix, newConfig.LaunchCmd)
}
fmt.Printf("Modify the configuration file at %s if you need to customize it\n\n", cfgPath)
}
@ -115,14 +119,12 @@ func setupConfig(rerun bool) (*Config, error) {
}
func promptYesNo(prompt string) (bool, error) {
var s string
for {
fmt.Print(prompt)
_, err := fmt.Scanf("%s", &s)
s, err := readLine()
if err != nil {
return false, fmt.Errorf("unable to read input: %v", err)
}
s := strings.TrimSpace(s)
if s == "y" || s == "Y" {
return true, nil
@ -139,10 +141,18 @@ func input(prompt string) (string, error) {
fmt.Println(prompt)
fmt.Printf("> ")
var s string
_, err := fmt.Scanf("%s", &s)
s, err := readLine()
if err != nil {
return "", fmt.Errorf("unable to read input: %v", err)
}
return strings.TrimSpace(s), nil
return s, nil
}
func readLine() (string, error) {
reader := bufio.NewReader(os.Stdin)
in, err := reader.ReadString('\n')
if err != nil {
return "", fmt.Errorf("unable to read input: %v", err)
}
return strings.TrimSpace(in), nil
}

View File

@ -11,7 +11,6 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
)
@ -70,6 +69,11 @@ func main() {
fmt.Printf("%d files are already up to date\n\n", stats.current)
}
if configRun {
fmt.Println("Configuration complete!")
os.Exit(0)
}
if updateOnlyFlag {
os.Exit(0)
}
@ -81,9 +85,6 @@ func main() {
fmt.Println("Starting Epoch...")
var cmd = strings.Split(config.LaunchCmd, " ")
if runtime.GOOS == "darwin" {
cmd = append([]string{"open"}, cmd...)
}
ex := exec.Command(cmd[0], cmd[1:]...)
cmdStr := strings.Join(cmd, " ")
if config.WinePrefix != "" {

View File

@ -7,7 +7,7 @@ import (
"regexp"
)
const version = "1.0.6"
const version = "1.0.7"
const versionUrl = "https://git.burkey.co/eburk/epochcli/raw/branch/master/version.go"
func needUpdate() (bool, error) {