slate 0.4.0.0 → 0.5.0.0
raw patch · 3 files changed
+35/−19 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +10/−8
- slate.cabal +3/−3
- src/Lib.hs +22/−8
README.md view
@@ -27,8 +27,10 @@ Available commands: add Add a note.- done Mark a note as done.- todo Mark a note as to-do.+ done Mark a note as done when given a note ID, display+ done notes otherwise.+ todo Mark a note as todo when given a note ID, display+ todo notes otherwise. remove Remove a note. display Display a slate. rename Rename a slate.@@ -42,28 +44,28 @@ $ slate done 0 $ slate display-<s>00 - My first note.</s>+<s>00 - My <b>first</b> note.</s> 01 - New note! -$ slate display --only=todo+$ slate display --only=todo # or just slate todo 01 - New note! $ slate add "Fake note" $ slate display-<s>00 - My first note.</s>+<s>00 - My <b>first</b> note.</s> 01 - New note! 02 - Fake note $ slate remove 2 $ slate display-<s>00 - My first note.</s>+<s>00 - My <b>first</b> note.</s> 01 - New note! $ slate wipe --only=todo $ slate display-<s>00 - My first note.</s>+<s>00 - My <b>first</b> note.</s> $ slate todo 0 $ slate display-00 - My first note.+00 - My <b>first</b> note. </pre>
slate.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+-- This file has been generated from package.yaml by hpack version 0.21.2. -- -- see: https://github.com/sol/hpack ----- hash: edb8e7f9ac7e6790ea6e2c0e191b5cff55cfc5e8285924b5f72abdb18c125fae+-- hash: a81225f08162330e47d2508662b80ad4173c5197ba2b1bd34285bd1bba0d1cad name: slate-version: 0.4.0.0+version: 0.5.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
@@ -22,15 +22,17 @@ type NoteId = Int +type MaybeNoteId = Maybe Int+ type Filter = String data Command = Add Slate Note | Done Slate- NoteId+ MaybeNoteId | Todo Slate- NoteId+ MaybeNoteId | Remove Slate NoteId | Display Slate@@ -53,10 +55,10 @@ add = Add <$> name <*> argument str (metavar "NOTE") done :: Parser Command-done = Done <$> name <*> argument auto (metavar "NOTE ID")+done = Done <$> name <*> optional (argument auto (metavar "NOTE ID")) todo :: Parser Command-todo = Todo <$> name <*> argument auto (metavar "NOTE ID")+todo = Todo <$> name <*> optional (argument auto (metavar "NOTE ID")) remove :: Parser Command remove = Remove <$> name <*> argument auto (metavar "NOTE ID")@@ -85,8 +87,18 @@ parser = subparser (command "add" (info add (progDesc "Add a note.")) <>- command "done" (info done (progDesc "Mark a note as done.")) <>- command "todo" (info todo (progDesc "Mark a note as to-do.")) <>+ command+ "done"+ (info+ done+ (progDesc+ "Mark a note as done when given a note ID, display done notes otherwise.")) <>+ command+ "todo"+ (info+ todo+ (progDesc+ "Mark a note as todo when given a note ID, display todo notes otherwise.")) <> command "remove" (info remove (progDesc "Remove a note.")) <> command "display" (info display (progDesc "Display a slate.")) <> command "rename" (info rename (progDesc "Rename a slate.")) <>@@ -98,9 +110,11 @@ execute (Add s n) = getSlatePath s >>= (\x -> appendFile x (" - [ ] " ++ n ++ "\n")) execute (Done "" n) = getSlateName >>= (\x -> execute (Done x n))-execute (Done s n) = getSlatePath s >>= (\x -> markAsDone x n)+execute (Done s (Just n)) = getSlatePath s >>= (\x -> markAsDone x n)+execute (Done s Nothing) = getSlatePath s >>= (\x -> displaySlate x "done") execute (Todo "" n) = getSlateName >>= (\x -> execute (Todo x n))-execute (Todo s n) = getSlatePath s >>= (\x -> markAsTodo x n)+execute (Todo s (Just n)) = getSlatePath s >>= (\x -> markAsTodo x n)+execute (Todo s Nothing) = getSlatePath s >>= (\x -> displaySlate x "todo") execute (Remove "" n) = getSlateName >>= (\x -> execute (Remove x n)) execute (Remove s n) = getSlatePath s >>= (\x -> removeNote x n) execute (Display "" f) = getSlateName >>= (\x -> execute (Display x f))