This commit is contained in:
voidlizard 2025-05-19 16:41:43 +03:00
parent 9f21d78416
commit 3450c97baa
2 changed files with 25 additions and 4 deletions

View File

@ -7,9 +7,26 @@
(match *args
( (list? [sym? store] ...)
(begin
# (local optdef (kw -g 1 --group-key 1))
# (local opts (cli:split optdef ...))
(println "FUCKING STORE " ... ))
(local optdef (kw -g 1 --group-key 1))
(local cli (cli:split optdef ...))
(local opts (nth 0 cli))
(local gk1 (lookup:uw --group-key opts))
(local gk2 (lookup:uw -g opts))
(local gk (car (filter [fn x . [not [nil? x]]] `[,gk1 ,gk2])))
(local fname (head (nth 1 cli)))
(local kwa `[ ,(if gk [list :gk gk] '() )
]
)
[local r
(if fname
(hbs2:tree:metadata:file kwa fname)
(hbs2:tree:metadata:stdin kwa))]
(display r)
)
)

View File

@ -29,6 +29,7 @@ import Control.Monad.Trans.Maybe
import Control.Monad.Trans.Cont
import Data.ByteString.Lazy qualified as LBS
import Data.ByteString.Lazy (ByteString)
import Data.ByteString.Char8 qualified as BS8
import Data.Either
import Data.Set qualified as Set
import Data.HashMap.Strict qualified as HM
@ -225,7 +226,10 @@ file-name: "qqq.txt"
metadataCreateMan $ args [kw] $
entry $ bindMatch "hbs2:tree:metadata:stdin" $ \case
[syn@(ListVal{})] -> do
doCreateMetadataTree mempty syn (liftIO LBS.getContents)
_reader <- hIsTerminalDevice stdin >>= \case
_ -> pure (liftIO LBS.getContents)
doCreateMetadataTree mempty syn _reader
_ -> throwIO (BadFormException @c nil)