2022-07-07 20:27:00 -04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2022-07-08 22:12:39 -04:00
|
|
|
func advancedMenu(app *application) {
|
2022-07-07 20:27:00 -04:00
|
|
|
|
|
|
|
var option string
|
|
|
|
|
|
|
|
for option != "0" {
|
|
|
|
|
|
|
|
fmt.Print("\nAdvanced Menu\n-------------\n\n")
|
|
|
|
|
2022-07-08 22:12:39 -04:00
|
|
|
fmt.Println("1. Change units (Default: Imperial)")
|
2022-07-07 20:27:00 -04:00
|
|
|
fmt.Println("2. Enter precise location")
|
|
|
|
fmt.Print("0. Back\n\n")
|
|
|
|
|
|
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
input, err := reader.ReadString('\n')
|
|
|
|
if err != nil {
|
2022-07-08 22:12:39 -04:00
|
|
|
log.Println(err)
|
2022-07-07 20:27:00 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
option = strings.TrimSuffix(input, "\n")
|
|
|
|
|
|
|
|
if option == "1" {
|
2022-07-08 22:12:39 -04:00
|
|
|
current := app.Config.Units
|
|
|
|
if current == "imperial" {
|
|
|
|
app.Config.Units = "metric"
|
2022-07-07 23:43:16 -04:00
|
|
|
} else {
|
2022-07-08 22:12:39 -04:00
|
|
|
app.Config.Units = "imperial"
|
2022-07-07 23:43:16 -04:00
|
|
|
}
|
2022-07-08 22:12:39 -04:00
|
|
|
fmt.Printf("\nChanged units from %s to %s...\n\n", current, app.Config.Units)
|
2022-07-07 20:27:00 -04:00
|
|
|
} else if option == "2" {
|
2022-07-08 22:12:39 -04:00
|
|
|
getPreciseLocation(app)
|
2022-07-07 20:27:00 -04:00
|
|
|
}
|
|
|
|
}
|
2022-07-08 22:12:39 -04:00
|
|
|
app.WaitGroup.Done()
|
2022-07-07 20:27:00 -04:00
|
|
|
}
|