lib/nswparks/cli.rb
# Starts the app and gives users the available options for the app
Starts the app and gives users the available options for the app
Starts the app and gives users the available options for the app
def start
    main_menu_option = nil
    while main_menu_option != "exit"
      puts ""
      puts "For a list of NSW National Parks and information on a park enter 'info'"
      puts "To exit the program enter 'exit'"
      puts "To see the National Park regions in NSW and choose a park by its region enter 'region'"
      puts "To access an interactive map of all National Parks in NSW enter 'map'"
      puts "To download a free pocket guide for NSW National Park Regions enter 'guide'"
      puts "To visit the website for a National Park enter 'url'"
      puts ""
      main_menu_option = gets.strip
      if main_menu_option == "info"
          park_info         
      elsif main_menu_option == "region"
          park_region 
      elsif main_menu_option == "url"
          NSWParks::Nsw_parks.park_url
      elsif main_menu_option == "map"
          NSWParks::Nsw_parks.park_map  
      elsif main_menu_option == "guide"
          NSWParks::Nsw_parks.park_guide  
      elsif main_menu_option != "exit"
          puts ""
          puts "---------------------------------------------"
          puts "Please enter one of the options from the list"  
          puts "---------------------------------------------"                                   
      end 
    end  
    puts ""
    puts "---------------------------------------------------------"
    puts "Thank you for using the Unofficial NSW National Parks App"  
    puts "---------------------------------------------------------" 
    puts ""   
  end
def start main_menu_option = nil while main_menu_option != "exit" puts "" puts "For a list of NSW National Parks and information on a park enter 'info'" puts "To exit the program enter 'exit'" puts "To see the National Park regions in NSW and choose a park by its region enter 'region'" puts "To access an interactive map of all National Parks in NSW enter 'map'" puts "To download a free pocket guide for NSW National Park Regions enter 'guide'" puts "To visit the website for a National Park enter 'url'" puts "" main_menu_option = gets . strip if main_menu_option == "info" park_info elsif main_menu_option == "region" park_region elsif main_menu_option == "url" NSWParks :: Nsw_parks . park_url elsif main_menu_option == "map" NSWParks :: Nsw_parks . park_map elsif main_menu_option == "guide" NSWParks :: Nsw_parks . park_guide elsif main_menu_option != "exit" puts "" puts "---------------------------------------------" puts "Please enter one of the options from the list" puts "---------------------------------------------" end end puts "" puts "---------------------------------------------------------" puts "Thank you for using the Unofficial NSW National Parks App" puts "---------------------------------------------------------" puts "" end
Starts the app and gives users the available options for the app
Starts the app and gives users the available options for the app
# Validates the user input               # Prompt user to enter again 