show lww data

This commit is contained in:
Dmitry Zuikov 2024-03-15 13:59:27 +03:00
parent 9e0468079b
commit 5610e392c6
2 changed files with 9 additions and 1 deletions

View File

@ -99,6 +99,7 @@ pImport = do
pTools :: GitPerks m => Parser (GitCLI m ()) pTools :: GitPerks m => Parser (GitCLI m ())
pTools = hsubparser ( command "dump-pack" (info pDumpPack (progDesc "dump hbs2 git pack")) pTools = hsubparser ( command "dump-pack" (info pDumpPack (progDesc "dump hbs2 git pack"))
<> command "show-ref" (info pShowRef (progDesc "show current references")) <> command "show-ref" (info pShowRef (progDesc "show current references"))
<> command "show-remotes" (info pShowLww (progDesc "show current remotes (hbs2 references)"))
) )
@ -135,6 +136,13 @@ pDumpPack = do
( long "pack" ) ( long "pack" )
pShowLww :: GitPerks m => Parser (GitCLI m ())
pShowLww = pure do
items <- withState selectAllLww
liftIO $ print $ vcat (fmap fmt items)
where
fmt (l,n,k) = fill 4 (pretty n) <+> fill 32 (pretty l) <+> fill 32 (pretty (AsBase58 k))
pShowRef :: GitPerks m => Parser (GitCLI m ()) pShowRef :: GitPerks m => Parser (GitCLI m ())
pShowRef = do pShowRef = do
pure do pure do

View File

@ -170,7 +170,7 @@ createLwwTable = do
ddl [qc| ddl [qc|
create table if not exists lww create table if not exists lww
( hash text not null ( hash text not null
, seq text not null , seq int not null
, reflog text not null , reflog text not null
, primary key (hash,seq,reflog) , primary key (hash,seq,reflog)
) )