slate 0.8.0.0 → 0.8.1.0
raw patch · 2 files changed
+21/−11 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- slate.cabal +2/−2
- src/Lib.hs +19/−9
slate.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: ecbc24207c5b0e342b6af0a2f1bb74ad47382085587f7de0966aba3ba65482d2+-- hash: 17c5e9ad0a8ba60142cfd66ace19c7563a5c9c326317bb5a523bdf52094fa452 name: slate-version: 0.8.0.0+version: 0.8.1.0 synopsis: A note taking CLI tool. description: Please see the README on Github at <https://github.com/evuez/slate#readme> homepage: https://github.com/evuez/slate#readme
src/Lib.hs view
@@ -201,7 +201,7 @@ contents <- readFile s let notes = zipWith displayNote [0 ..] (lines contents) putStr $ unlines $ filter (not . isNoteDone) notes-displaySlate _ f = putStr $ "\"" ++ f ++ "\" is not a valid filter."+displaySlate _ f = putStrLn $ "\"" ++ f ++ "\" is not a valid filter." displayNote :: Int -> String -> String displayNote line (' ':'-':' ':'[':' ':']':note) =@@ -269,17 +269,27 @@ let tmp = s ++ ".tmp" writeFile tmp $ unlines $ filter isNoteDone (lines contents) renameFile tmp s-wipeSlate _ f = putStr $ "\"" ++ f ++ "\" is not a valid filter."+wipeSlate _ f = putStrLn $ "\"" ++ f ++ "\" is not a valid filter." displayStatus :: FilePath -> IO () displayStatus s = do ss <- getSyncStatus s contents <- readFile s- let t = length $ filter isNoteDone (lines contents)- d = length $ filter (not . isNoteDone) (lines contents)- putStr $+ let d = length $ filter isNoteDone (lines contents)+ t = length $ filter (not . isNoteDone) (lines contents)+ dd = fromIntegral d :: Double+ dt = fromIntegral t :: Double+ pd = round $ 28 * dd / (dt + dd)+ pt = round $ 28 * dt / (dt + dd)+ putStrLn $+ (show d) +++ " done, " ++ (show t) ++- " done, " ++ (show d) ++ " todo (" ++ (show $ t + d) ++ " total)." ++ ss+ " todo (" +++ (show $ d + t) +++ " total).\n" +++ "\x1B[32m" +++ (replicate pd '▮') ++ "\x1B[0m" ++ (replicate pt '▮') ++ "\n" ++ ss getSyncStatus :: FilePath -> IO String getSyncStatus s = do@@ -294,8 +304,8 @@ e <- waitForProcess h return $ case e of- ExitSuccess -> " \x1B[32mSynced ☺️\x1B[1m"- (ExitFailure _) -> " \x1B[31mOut of sync 😕\x1B[1m"+ ExitSuccess -> "\x1B[32mSynced ☺️\x1B[0m"+ (ExitFailure _) -> "\x1B[31mOut of sync 😕\x1B[0m" Nothing -> return "" syncSlates :: IO ()@@ -304,4 +314,4 @@ d <- getConfigDirectory (_, _, _, h) <- createProcess (shell c) {cwd = Just d} _ <- waitForProcess h- putStr "\x1B[32mDone syncing ☺️\x1B[1m"+ putStrLn "\x1B[32mDone syncing ☺️\x1B[0m"