module Rob.Actions.List (main) where
import Rob.Logger (info)
import Rob.UserMessages (availableTemplates, emptyString)
import Rob.Config (get, errorNoTemplatesAvailable)
import Rob.Types(Config(..))
import System.Exit (exitSuccess)
main :: IO()
main :: IO ()
main = do
Config
config <- IO Config
get
String -> IO ()
putStrLn String
emptyString
String -> IO ()
info String
availableTemplates
String -> IO ()
putStrLn String
emptyString
Config -> IO ()
listTemplates Config
config
IO ()
forall a. IO a
exitSuccess
listTemplates :: Config -> IO ()
listTemplates :: Config -> IO ()
listTemplates (Config []) = IO ()
errorNoTemplatesAvailable;
listTemplates (Config [Template]
templates) = String -> IO ()
putStrLn (String -> IO ()) -> String -> IO ()
forall a b. (a -> b) -> a -> b
$ [String] -> String
unlines ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$ (Template -> String) -> [Template] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Template -> String
forall a. Show a => a -> String
show [Template]
templates