forked from GitHub/gf-core
lib/src/api/libraryBrowser/MkLang.hs - allow multiple arguments
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
|
||||
import System.Environment (getArgs)
|
||||
import Data.List.Utils (replace)
|
||||
|
||||
name = "LibraryBrowserEng.gf"
|
||||
|
||||
main = do
|
||||
a <- getArgs
|
||||
case a of
|
||||
lang:_ -> do
|
||||
contents <- readFile name
|
||||
let name' = replace "Eng" lang name
|
||||
let contents' = replace "Eng" lang contents
|
||||
writeFile name' contents'
|
||||
putStrLn $ "Wrote " ++ name'
|
||||
_ -> print "You need to provide a language code"
|
||||
[] -> print "You need to provide a language code"
|
||||
langs -> mapM_ makeOne langs
|
||||
|
||||
name = "LibraryBrowserEng.gf"
|
||||
|
||||
makeOne "Eng" = putStrLn "Skipping Eng"
|
||||
makeOne lang = do
|
||||
contents <- readFile name
|
||||
let name' = replace "Eng" lang name
|
||||
let contents' = replace "Eng" lang contents
|
||||
writeFile name' contents'
|
||||
putStrLn $ "Wrote " ++ name'
|
||||
|
||||
Reference in New Issue
Block a user