output report to a text file (report.txt)
This commit is contained in:
parent
4a8515b862
commit
db62fbb542
|
@ -2,6 +2,7 @@
|
|||
|
||||
## current
|
||||
- Fixed a bug that was causing shutouts to not be recorded
|
||||
- Output report to a text file (report.txt)
|
||||
|
||||
## 0.13.0
|
||||
- Added autocomplete to player position prompt
|
||||
|
|
|
@ -44,3 +44,11 @@ maxAssists = 2
|
|||
-- | The length of a typical game (in minutes)
|
||||
gameLength :: Int
|
||||
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
|
||||
|
||||
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 Lens.Micro ((^.), (.~))
|
||||
import qualified UI.NCurses as C
|
||||
|
||||
import Mtlstats.Actions
|
||||
import Mtlstats.Actions.NewGame
|
||||
import Mtlstats.Config
|
||||
import Mtlstats.Control.NewGame.GoalieInput
|
||||
import Mtlstats.Format
|
||||
import Mtlstats.Handlers
|
||||
|
@ -211,8 +213,11 @@ reportC = Controller
|
|||
C.EventSpecialKey C.KeyUpArrow -> modify scrollUp
|
||||
C.EventSpecialKey C.KeyDownArrow -> modify scrollDown
|
||||
C.EventSpecialKey C.KeyHome -> modify $ scrollOffset .~ 0
|
||||
C.EventSpecialKey _ -> modify backHome
|
||||
C.EventCharacter _ -> modify backHome
|
||||
|
||||
C.EventCharacter '\n' -> do
|
||||
get >>= liftIO . writeFile reportFilename . unlines . report reportCols
|
||||
modify backHome
|
||||
|
||||
_ -> return ()
|
||||
return True
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user