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