wip, cat command

This commit is contained in:
Dmitry Zuikov 2024-08-07 19:39:14 +03:00
parent 71bad89b7d
commit dfe9d0ba9b
1 changed files with 20 additions and 0 deletions

View File

@ -1098,6 +1098,26 @@ syncEntries = do
w -> err $ "invalid sign key" <+> pretty (mkList w)
brief "output file from remote state"
$ args [arg "string" "refchan", arg "string" "file"]
$ entry $ bindMatch "cat" $ nil_ $ \case
[SignPubKeyLike rchan, StringLike fn] -> do
sto <- getStorage
void $ runMaybeT do
h <- lift (getStateFromRefChan rchan)
<&> Map.fromList
<&> Map.lookup fn
>>= toMPlus
<&> getEntryHash
>>= toMPlus
lbs <- lift $ runExceptT (getTreeContents sto h)
>>= orThrowPassIO
liftIO $ LBS.putStr lbs
_ -> none
entry $ bindMatch "dir:state:merged:show" $ nil_ $ \_ -> do
state <- getStateFromDir0 True