Merge pull request #79 from mtlstats/report-file
output report to a text file (report.txt)
This commit is contained in:
commit
e15623bde3
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
## current
|
## current
|
||||||
- Fixed a bug that was causing shutouts to not be recorded
|
- Fixed a bug that was causing shutouts to not be recorded
|
||||||
|
- Output report to a text file (report.txt)
|
||||||
|
|
||||||
## 0.13.0
|
## 0.13.0
|
||||||
- Added autocomplete to player position prompt
|
- Added autocomplete to player position prompt
|
||||||
|
|
|
@ -44,3 +44,11 @@ maxAssists = 2
|
||||||
-- | The length of a typical game (in minutes)
|
-- | The length of a typical game (in minutes)
|
||||||
gameLength :: Int
|
gameLength :: Int
|
||||||
gameLength = 60
|
gameLength = 60
|
||||||
|
|
||||||
|
-- | Report output filename
|
||||||
|
reportFilename :: FilePath
|
||||||
|
reportFilename = "report.txt"
|
||||||
|
|
||||||
|
-- | Number of columns in report file
|
||||||
|
reportCols :: Int
|
||||||
|
reportCols = 79
|
||||||
|
|
|
@ -21,13 +21,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module Mtlstats.Control.NewGame (newGameC) where
|
module Mtlstats.Control.NewGame (newGameC) where
|
||||||
|
|
||||||
import Control.Monad.Trans.State (gets, modify)
|
import Control.Monad.IO.Class (liftIO)
|
||||||
|
import Control.Monad.Trans.State (get, gets, modify)
|
||||||
import Data.Maybe (fromJust, fromMaybe, isJust)
|
import Data.Maybe (fromJust, fromMaybe, isJust)
|
||||||
import Lens.Micro ((^.), (.~))
|
import Lens.Micro ((^.), (.~))
|
||||||
import qualified UI.NCurses as C
|
import qualified UI.NCurses as C
|
||||||
|
|
||||||
import Mtlstats.Actions
|
import Mtlstats.Actions
|
||||||
import Mtlstats.Actions.NewGame
|
import Mtlstats.Actions.NewGame
|
||||||
|
import Mtlstats.Config
|
||||||
import Mtlstats.Control.NewGame.GoalieInput
|
import Mtlstats.Control.NewGame.GoalieInput
|
||||||
import Mtlstats.Format
|
import Mtlstats.Format
|
||||||
import Mtlstats.Handlers
|
import Mtlstats.Handlers
|
||||||
|
@ -211,9 +213,12 @@ reportC = Controller
|
||||||
C.EventSpecialKey C.KeyUpArrow -> modify scrollUp
|
C.EventSpecialKey C.KeyUpArrow -> modify scrollUp
|
||||||
C.EventSpecialKey C.KeyDownArrow -> modify scrollDown
|
C.EventSpecialKey C.KeyDownArrow -> modify scrollDown
|
||||||
C.EventSpecialKey C.KeyHome -> modify $ scrollOffset .~ 0
|
C.EventSpecialKey C.KeyHome -> modify $ scrollOffset .~ 0
|
||||||
C.EventSpecialKey _ -> modify backHome
|
|
||||||
C.EventCharacter _ -> modify backHome
|
C.EventCharacter '\n' -> do
|
||||||
_ -> return ()
|
get >>= liftIO . writeFile reportFilename . unlines . report reportCols
|
||||||
|
modify backHome
|
||||||
|
|
||||||
|
_ -> return ()
|
||||||
return True
|
return True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user