summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs19
1 files changed, 16 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 8ddf84e..8803f8b 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -53,7 +53,8 @@ data Cmd
}
| List
{ filters :: [Filter],
- todo :: Bool
+ todo :: Bool,
+ view :: Bool
}
| Todo
| View
@@ -88,6 +89,7 @@ listCmd =
List
<$> filtersArg
<*> todoArg
+ <*> viewArg
todoCmd :: O.Parser Cmd
todoCmd =
@@ -139,7 +141,14 @@ todoArg :: O.Parser Bool
todoArg =
O.switch
( O.long "todo"
- <> O.help "Run command `todo` on listed documents."
+ <> O.help "Run command `todo` on listed document(s)"
+ )
+
+viewArg :: O.Parser Bool
+viewArg =
+ O.switch
+ ( O.long "view"
+ <> O.help "Run command `view` on listed document(s)"
)
data Filter
@@ -157,7 +166,7 @@ main = do
Args {cmd = Consume {keep, inputs}} ->
mapM_ putStrLn
=<< parMapM (consume1 keep) (map (cwd </>) inputs)
- Args {cmd = List {filters, todo = False}} -> do
+ Args {cmd = List {filters, todo = False, view = False}} -> do
mapM_
( \(Document {iFileName, index}) -> do
if hasTag (Tag "todo" Nothing) index
@@ -174,6 +183,10 @@ main = do
processDocuments
. applyFilters [FilterByTag "todo"]
=<< getDocuments
+ Args {cmd = List {filters, view = True}} -> do
+ viewDocuments
+ . applyFilters filters
+ =<< getDocuments
Args {cmd = View {indexNames}} -> do
viewDocuments
=<< mapM (readDocument . (<.> "json")) indexNames