slate 0.6.0.0 → 0.7.0.0
raw patch · 3 files changed
+23/−3 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +4/−0
- slate.cabal +3/−3
- src/Lib.hs +16/−0
README.md view
@@ -35,6 +35,7 @@ display Display a slate. rename Rename a slate. wipe Wipe a slate.+ status Display the status of a slate. sync Sync every slate. $ slate add "My *first* note."@@ -50,6 +51,9 @@ $ slate display --only=todo # or just slate todo 01 - New note!++$ slate status+1 done, 1 todo (2 total). $ slate add "Fake note" $ slate display
slate.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.21.2.+-- This file has been generated from package.yaml by hpack version 0.27.0. -- -- see: https://github.com/sol/hpack ----- hash: e87869f3ba6c0eeba97ff6dac9093244bf62e025a4d08405ca7bacadca82a856+-- hash: 9b756fbd1c67b7947d10d9cad34702e44448b59d65e55924fd10ffd6ea613601 name: slate-version: 0.6.0.0+version: 0.7.0.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
@@ -47,6 +47,7 @@ Slate | Wipe Slate Filter+ | Status Slate | Sync deriving (Eq, Show) @@ -90,6 +91,9 @@ str (long "only" <> short 'o' <> help "Wipe only done / todo notes." <> value "") +status :: Parser Command+status = Status <$> name+ sync :: Command sync = Sync @@ -113,6 +117,7 @@ command "display" (info display (progDesc "Display a slate.")) <> command "rename" (info rename (progDesc "Rename a slate.")) <> command "wipe" (info wipe (progDesc "Wipe a slate.")) <>+ command "status" (info status (progDesc "Display the status of a slate.")) <> command "sync" (info (pure sync) (progDesc "Sync every slate."))) -- Commands@@ -134,6 +139,8 @@ execute (Wipe "" f) = getSlateName >>= (\x -> execute (Wipe x f)) execute (Wipe s "") = getSlatePath s >>= removeFile execute (Wipe s f) = getSlatePath s >>= (\x -> wipeSlate x f)+execute (Status "") = getSlateName >>= (\x -> execute (Status x))+execute (Status s) = getSlatePath s >>= (\x -> displayStatus x) execute (Sync) = syncSlates -- Helpers@@ -242,6 +249,15 @@ writeFile tmp $ unlines $ filter isNoteDone (lines contents) renameFile tmp s wipeSlate _ f = putStr $ "\"" ++ f ++ "\" is not a valid filter."++displayStatus :: FilePath -> IO ()+displayStatus s = do+ contents <- readFile s+ let t = length $ filter isNoteDone (lines contents)+ d = length $ filter (not . isNoteDone) (lines contents)+ putStr $+ (show t) +++ " done, " ++ (show d) ++ " todo (" ++ (show $ t + d) ++ " total)." syncSlates :: IO () syncSlates = do