mirror of
https://codeberg.org/andyscott/weather-cli.git
synced 2024-12-21 12:43:09 -05:00
Reset temp after checking for valid location
This commit is contained in:
parent
7d59138191
commit
13f1e5da8c
1 changed files with 5 additions and 0 deletions
|
@ -12,6 +12,7 @@ func advancedMenu(app *application) {
|
|||
|
||||
var option string
|
||||
|
||||
// Menu loop
|
||||
for option != "0" {
|
||||
|
||||
fmt.Print("\nAdvanced Menu\n-------------\n\n")
|
||||
|
@ -20,6 +21,7 @@ func advancedMenu(app *application) {
|
|||
fmt.Println("2. Enter precise location")
|
||||
fmt.Print("0. Back\n\n")
|
||||
|
||||
// Read user input
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
input, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
|
@ -28,6 +30,7 @@ func advancedMenu(app *application) {
|
|||
|
||||
option = strings.TrimSuffix(input, "\n")
|
||||
|
||||
// Check user input
|
||||
if option == "1" {
|
||||
current := app.Config.Units
|
||||
if current == "imperial" {
|
||||
|
@ -38,6 +41,7 @@ func advancedMenu(app *application) {
|
|||
fmt.Printf("\nChanged units from %s to %s...\n\n", current, app.Config.Units)
|
||||
} else if option == "2" {
|
||||
|
||||
// Loop to validate location entered
|
||||
var validLoc bool
|
||||
for !validLoc {
|
||||
getPreciseLocation(app)
|
||||
|
@ -52,6 +56,7 @@ func advancedMenu(app *application) {
|
|||
}
|
||||
|
||||
printWeather(app)
|
||||
app.Forecast.Main.Temp = 0.00
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue