From ec2a16b5606366c393149ee42c690f789d3a8423 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Mon, 12 Oct 2026 11:20:58 +0100 Subject: [PATCH 1/2] Use Json format when no results found --- src/Action/Search.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Action/Search.hs b/src/Action/Search.hs index b86ed552..83e08b79 100644 --- a/src/Action/Search.hs +++ b/src/Action/Search.hs @@ -54,7 +54,9 @@ actionSearch Search{..} = replicateM_ repeat_ $ -- deliberately reopen the datab Nothing -> hSupportsANSI stdout let (shown, hidden) = splitAt count' $ nubOrd $ map (targetResultDisplay link color' q) res if null res then - putStrLn "No results found" + if | json -> putStrLn "[]" + | jsonl -> putStrLn "" + | otherwise -> putStrLn "No results found" else if info then do mapM_ (putStr . targetInfo color' q) $ (case count of From 3c7f68d5819df015838f1455d7616812ca31897a Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Tue, 20 Oct 2026 12:01:55 +0100 Subject: [PATCH 2/2] Do not print "more results" when jsonl --- src/Action/Search.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Action/Search.hs b/src/Action/Search.hs index 83e08b79..aea0b462 100644 --- a/src/Action/Search.hs +++ b/src/Action/Search.hs @@ -66,7 +66,7 @@ actionSearch Search{..} = replicateM_ repeat_ $ -- deliberately reopen the datab if | json -> LBS.putStrLn $ JSON.encode $ maybe id take count $ map unHTMLtargetItem res | jsonl -> mapM_ (LBS.putStrLn . JSON.encode) $ maybe id take count $ map unHTMLtargetItem res | otherwise -> putStr $ unlines $ if numbers then addCounter shown else shown - when (hidden /= [] && not json) $ do + when (hidden /= [] && not json && not jsonl) $ do whenNormal $ putStrLn $ "-- plus more results not shown, pass --count=" ++ show (count'+10) ++ " to see more" else do let parseType x = case parseQuery x of