Skip to content

Commit

Permalink
colors
Browse files Browse the repository at this point in the history
  • Loading branch information
v4zha committed Aug 19, 2022
1 parent c4e9a3b commit 129a995
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
11 changes: 7 additions & 4 deletions app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import Control.Exception (try)
import Data.Maybe (fromJust)
import Options.Applicative (execParser)
import System.Directory (getHomeDirectory)
import Text.Termcolor (format)
import qualified Text.Termcolor.Foreground as F
import Text.Termcolor.Style (bold)
import Vbanner (vModBanner)
import Vloader
( Config (confFile),
Expand All @@ -27,13 +30,13 @@ main = greeter =<< execParser opts
greeter :: Config -> IO ()
greeter config =
do
putStrLn vModBanner
putStrLn . format . bold $ read vModBanner
home <- getHomeDirectory
modLs <- sanitizePath <$> getConfig (confFile config)
let modConf = fromMaybeConfig modLs
let [res, mods] = replaceHome home <$> [resFile modConf, modPath modConf]
putStrLn "[*] : Getting Modules : "
mapM_ (putStrLn . (" >> " ++)) . modules $modConf
putStrLn . format . bold . F.yellow . read $ "[*] : Getting Modules : "
mapM_ (putStrLn . format . bold . F.cyan . read . (" >> " ++)) . modules $modConf
luaMods <- mapM (getMods mods) . modules $modConf
putStrLn $ "[*] : Writing to file : " ++ res ++ ".lua"
putStrLn . format . bold . F.green . read $ "[*] : Writing to file : " ++ res ++ ".lua"
writeMods luaMods res
3 changes: 2 additions & 1 deletion mod-loader.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ executable vmod
filepath >= 1.4.2.1,
yaml >= 0.11.8.0,
text>=1.2.3.1,
optparse-applicative>=0.17.0.0
optparse-applicative>=0.17.0.0,
termcolor>=0.2.0.0

hs-source-dirs: app , src
default-language: Haskell2010
5 changes: 3 additions & 2 deletions src/Vbanner.hs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module Vbanner where

vModBanner :: [Char]
vModBanner =
" \n \
\ .===============================. \n \
\ || || \n \
\ || || \n \
\ || >>= V Mod Loader || \n \
\ || \ESC[38:5:10m \t >>= \ESC[38:5:13m V Mod Loader \ESC[0;0m\t ||\n \
\ || || \n \
\ || - : ) V4zha || \n \
\ || \ESC[38:5:14m \t - V4zha : )\ESC[0;0m \t || \n \
\ .===============================. \n \
\ "
5 changes: 4 additions & 1 deletion src/Vloader.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import Options.Applicative (Parser, ParserInfo, fullDesc, header, help, helper,
import System.Directory (getDirectoryContents, getHomeDirectory)
import System.FilePath ()
import System.IO ()
import Text.Termcolor (format)
import qualified Text.Termcolor.Foreground as F
import Text.Termcolor.Style (bold)

data ModConfig = ModConfig
{ modPath :: String,
Expand Down Expand Up @@ -67,7 +70,7 @@ getMods modPath modName = do
dirFiles <- try . getDirectoryContents $ modPath ++ "/" ++ modName :: IO (Either IOError [FilePath])
case dirFiles of
Right mods -> return $modgen modName mods
Left err -> "" <$ putStrLn ("\nError parsing Module : " ++ modName ++ "\n>> [Error]: " ++ show err ++ "\n")
Left err -> "" <$ (putStrLn . format . bold . F.red . read $("\nError parsing Module : " ++ modName ++ "\n>> [Error]: " ++ show err ++ "\n"))

modgen :: String -> [FilePath] -> String
modgen modName dirFiles =
Expand Down

1 comment on commit 129a995

@v4zha
Copy link
Owner Author

@v4zha v4zha commented on 129a995 Aug 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added colors
and colorised banner : )

Please sign in to comment.