File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ search_ = Search
134134 ,jsonl = def &= name " jsonl" &= help " Get result as JSONL (JSON Lines)"
135135 ,link = def &= help " Give URL's for each result"
136136 ,numbers = def &= help " Give counter for each result"
137- ,info = def &= help " Give extended information about the first result "
137+ ,info = def &= help " Give extended information about the first n results (set n with --count, default is 1) "
138138 ,database = def &= typFile &= help " Name of database to use (use .hoo extension)"
139139 ,count = Nothing &= name " n" &= help " Maximum number of results to return (defaults to 10)"
140140 ,query = def &= args &= typ " QUERY"
Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ actionSearch Search{..} = replicateM_ repeat_ $ -- deliberately reopen the datab
5656 if null res then
5757 putStrLn " No results found"
5858 else if info then do
59- putStr $ targetInfo color' q $ headErr res
59+ mapM_ (putStr . targetInfo color' q)
60+ $ (case count of
61+ Just c -> take c
62+ Nothing -> singleton . headErr) res
6063 else do
6164 if | json -> LBS. putStrLn $ JSON. encode $ maybe id take count $ map unHTMLtargetItem res
6265 | jsonl -> mapM_ (LBS. putStrLn . JSON. encode) $ maybe id take count $ map unHTMLtargetItem res
You can’t perform that action at this time.
0 commit comments