diff --git a/app/Main.hs b/app/Main.hs index 5e6e36c..f3907dc 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -31,6 +31,7 @@ import Options.Applicative import Safe import System.Console.Pretty import System.Exit +import Text.Layout.Table @@ -123,12 +124,9 @@ lForkOpts = ListForkOptions <$> optional main :: IO () main = do - let - run e = do - settings <- - exceptT - (\_ -> - die + let run e = do + settings <- exceptT + (\_ -> die . color Red $ "Could not get settings, make sure to run 'ghup config' first" ) @@ -163,13 +161,17 @@ main = do Nothing -> pure Nothing forks <- withExceptT show $ getForks mtime - let formatted = intercalate "\n" $ fmap - (\Repo {..} -> - (T.unpack . getUrl $ repoHtmlUrl) <> " " <> formatShow - (iso8601Format :: Format Day) - (utctDay $ fromJust repoUpdatedAt) - ) - forks + let formatted = + gridString [column expand left def def + ,column expand left def def] + $ fmap + (\Repo {..} -> + [ (T.unpack . getUrl $ repoHtmlUrl) + , formatShow (iso8601Format :: Format Day) + (utctDay $ fromJust repoUpdatedAt) + ] + ) + forks liftIO $ putStrLn $ formatted pure () case e of diff --git a/ghup.cabal b/ghup.cabal index cb1266d..aafa457 100644 --- a/ghup.cabal +++ b/ghup.cabal @@ -55,6 +55,7 @@ executable ghup , optparse-applicative ^>= 0.15 , pretty-terminal ^>= 0.1 , safe ^>= 0.3 + , table-layout ^>= 0.8 , text ^>= 1.2 , time ^>= 1.9 , utf8-string ^>= 1.0