Update hard-coded target path
    
    
      
        Getty Ritter
        6 years ago
      
    
    
  
  
  | 16 | 16 | import qualified Parser | 
| 17 | 17 | import qualified Types | 
| 18 | 18 | |
| 19 | ||
| 19 | 20 | readMap :: FilePath -> IO Types.TableMap | 
| 20 | 21 | readMap path = do | 
| 21 | 22 | cs <- Text.readFile path | 
| 26 | 27 | |
| 27 | 28 | main :: IO () | 
| 28 | 29 | main = do | 
| 29 | tablesRef <- IO.newIORef =<< readMap " | |
| 30 | tablesRef <- IO.newIORef =<< readMap "perilous-wilds.txt" | |
| 30 | 31 | Readline.setCompletionEntryFunction $ Just $ \ rs -> do | 
| 31 | 32 | tables <- IO.readIORef tablesRef | 
| 32 | 33 | pure [ Text.unpack k | 
| 44 | 45 | tables <- IO.readIORef tablesRef | 
| 45 | 46 | Text.putStrLn "Available tables: " | 
| 46 | 47 | Text.putStrLn (" " <> Text.unwords (Map.keys tables)) | 
| 47 | IO.writeIORef tablesRef =<< readMap "tables.txt" | |
| 48 | 48 | Just ":r" -> | 
| 49 | IO.writeIORef tablesRef =<< readMap " | |
| 49 | IO.writeIORef tablesRef =<< readMap "perilous-wilds.txt" | |
| 50 | 50 | Just choice -> do | 
| 51 | 51 | tables <- IO.readIORef tablesRef | 
| 52 | 52 | let names = Text.unwords (Map.keys tables) |