mirror of https://github.com/voidlizard/hbs2
little bit formatting
This commit is contained in:
parent
6f5bd94221
commit
261641f719
|
@ -5,10 +5,11 @@ import HBS2.Base58
|
||||||
|
|
||||||
import HBS2Git.App
|
import HBS2Git.App
|
||||||
import HBS2Git.State
|
import HBS2Git.State
|
||||||
import HBS2Git.Config
|
import HBS2Git.Config
|
||||||
import HBS2Git.ListRefs
|
import HBS2Git.ListRefs
|
||||||
|
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
|
import Prettyprinter.Render.Terminal
|
||||||
|
|
||||||
data ShowObject = ShowRef RepoRef | ShowConfig
|
data ShowObject = ShowRef RepoRef | ShowConfig
|
||||||
|
|
||||||
|
@ -22,24 +23,24 @@ showRef h = do
|
||||||
print $ "current state for" <+> pretty (AsBase58 h)
|
print $ "current state for" <+> pretty (AsBase58 h)
|
||||||
print $ "head:" <+> pretty hd
|
print $ "head:" <+> pretty hd
|
||||||
print $ pretty "last operations:"
|
print $ pretty "last operations:"
|
||||||
for_ imported (\(t,h1,h2) -> print $ pretty t <+> pretty h1 <+> pretty h2)
|
for_ imported (\(t,h1,h2) -> print $ pretty t <+> pretty h1 <+> pretty h2)
|
||||||
|
|
||||||
showRefs :: MonadIO m => App m ()
|
showRefs :: MonadIO m => App m ()
|
||||||
showRefs = do
|
showRefs = do
|
||||||
liftIO $ print $ pretty "References:"
|
liftIO $ putDoc $ line <> green "References:" <> section
|
||||||
runListRefs
|
runListRefs
|
||||||
|
|
||||||
showConfig :: MonadIO m => App m ()
|
showConfig :: MonadIO m => App m ()
|
||||||
showConfig = liftIO do
|
showConfig = liftIO do
|
||||||
ConfigPathInfo{..} <- getConfigPathInfo
|
ConfigPathInfo{..} <- getConfigPathInfo
|
||||||
cfg <- readFile configFilePath
|
cfg <- readFile configFilePath
|
||||||
print $ "Config file location:" <> line <> pretty configFilePath <> line
|
putDoc $ green "Config file location:" <> section <> pretty configFilePath <> section
|
||||||
print $ "Config contents:" <> line <> pretty cfg
|
putDoc $ green "Config contents:" <> line <> pretty cfg
|
||||||
|
|
||||||
showSummary :: MonadIO m => App m ()
|
showSummary :: MonadIO m => App m ()
|
||||||
showSummary = do
|
showSummary = do
|
||||||
showRefs
|
showRefs
|
||||||
liftIO $ print $ pretty ""
|
liftIO $ putDoc section
|
||||||
showConfig
|
showConfig
|
||||||
|
|
||||||
runShow :: MonadIO m => Maybe ShowObject -> App m ()
|
runShow :: MonadIO m => Maybe ShowObject -> App m ()
|
||||||
|
|
|
@ -52,7 +52,7 @@ import System.IO.Unsafe (unsafePerformIO)
|
||||||
import Data.Cache qualified as Cache
|
import Data.Cache qualified as Cache
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
import System.Environment
|
import System.Environment
|
||||||
import Control.Monad.Catch
|
import Prettyprinter.Render.Terminal
|
||||||
|
|
||||||
instance MonadIO m => HasCfgKey ConfBranch (Set String) m where
|
instance MonadIO m => HasCfgKey ConfBranch (Set String) m where
|
||||||
key = "branch"
|
key = "branch"
|
||||||
|
@ -464,3 +464,9 @@ loadCredentials fp = do
|
||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
|
|
||||||
|
green = annotate (color Green)
|
||||||
|
|
||||||
|
yellow = annotate (color Yellow)
|
||||||
|
|
||||||
|
section = line <> line
|
||||||
|
|
||||||
|
|
|
@ -208,9 +208,6 @@ runExport :: forall m . (MonadIO m, MonadCatch m, HasProgress (App m))
|
||||||
=> Maybe FilePath -> RepoRef -> App m ()
|
=> Maybe FilePath -> RepoRef -> App m ()
|
||||||
runExport fp h = do
|
runExport fp h = do
|
||||||
|
|
||||||
let green = annotate (color Green)
|
|
||||||
let yellow = annotate (color Yellow)
|
|
||||||
let section = line <> line
|
|
||||||
|
|
||||||
liftIO $ putDoc $
|
liftIO $ putDoc $
|
||||||
line
|
line
|
||||||
|
|
|
@ -10,6 +10,7 @@ import HBS2.Git.Local.CLI
|
||||||
import Data.Functor
|
import Data.Functor
|
||||||
import Data.Text qualified as Text
|
import Data.Text qualified as Text
|
||||||
import Data.Traversable
|
import Data.Traversable
|
||||||
|
import Prettyprinter.Render.Terminal
|
||||||
|
|
||||||
data AsRemoteEntry = AsRemoteEntry
|
data AsRemoteEntry = AsRemoteEntry
|
||||||
{ remoteName :: Text,
|
{ remoteName :: Text,
|
||||||
|
@ -56,11 +57,11 @@ runListRefs = do
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
let header =
|
let header =
|
||||||
fill remoteNameColWidth "Name"
|
fill remoteNameColWidth (green "Name")
|
||||||
<+> fill remoteURLColWidth "URL"
|
<+> fill remoteURLColWidth (green "URL")
|
||||||
<+> fill remoteRefValueColWidth "Reference value"
|
<+> fill remoteRefValueColWidth (green "Reference value")
|
||||||
liftIO $ print header
|
liftIO $ putDoc $ header <> line
|
||||||
liftIO $ print $ vcat $ pretty <$> remoteEntries
|
liftIO $ putDoc $ vcat $ pretty <$> remoteEntries
|
||||||
where
|
where
|
||||||
isHbs2 (_, b) = Text.isPrefixOf hbs2Prefix b
|
isHbs2 (_, b) = Text.isPrefixOf hbs2Prefix b
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue