diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-07-26 23:29:47 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-07-26 23:29:47 +0200 |
commit | 71cfee5086a6bf1c7a810d83fd67320bb9552197 (patch) | |
tree | 5177eea786ae75bc9c2a9d6202f215cd722defe6 /src | |
parent | 941ba9a209fa03b1c059b2b02a8e4cf4a270030e (diff) |
Accept multiple refs for typed cat-file command
Diffstat (limited to 'src')
-rw-r--r-- | src/Main.hs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Main.hs b/src/Main.hs index c718c31..b51fa0d 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -75,17 +75,17 @@ main = do Nothing -> error "ref does not exist" Just ref -> BL.putStr $ lazyLoadBytes ref - ["cat-file", objtype, sref] -> do - readRef st (BC.pack sref) >>= \case + ("cat-file" : objtype : srefs@(_:_)) -> do + sequence <$> (mapM (readRef st . BC.pack) srefs) >>= \case Nothing -> error "ref does not exist" - Just ref -> case objtype of - "signed" -> do + Just refs -> case objtype of + "signed" -> forM_ refs $ \ref -> do let signed = load ref :: Signed Object BL.putStr $ lazyLoadBytes $ storedRef $ signedData signed forM_ (signedSignature signed) $ \sig -> do putStr $ "SIG " BC.putStrLn $ showRef $ storedRef $ sigKey $ fromStored sig - "identity" -> case validateIdentity (wrappedLoad ref) of + "identity" -> case validateIdentityF (wrappedLoad <$> refs) of Just identity -> do let disp :: Identity m -> IO () disp idt = do |