Slightly improved yesod init
This commit is contained in:
parent
c691a0143b
commit
068003cb36
@ -22,7 +22,8 @@ prompt f = do
|
|||||||
if f s
|
if f s
|
||||||
then return s
|
then return s
|
||||||
else do
|
else do
|
||||||
putStrLn "That was not a valid entry, please try again: "
|
putStr "That was not a valid entry, please try again: "
|
||||||
|
hFlush stdout
|
||||||
prompt f
|
prompt f
|
||||||
|
|
||||||
qq :: String
|
qq :: String
|
||||||
@ -45,7 +46,7 @@ backends = [minBound .. maxBound]
|
|||||||
scaffold :: IO ()
|
scaffold :: IO ()
|
||||||
scaffold = do
|
scaffold = do
|
||||||
puts $(codegenDir "input" "welcome")
|
puts $(codegenDir "input" "welcome")
|
||||||
name <- getLine
|
name <- prompt $ not . null
|
||||||
|
|
||||||
puts $(codegenDir "input" "project-name")
|
puts $(codegenDir "input" "project-name")
|
||||||
let validPN c
|
let validPN c
|
||||||
@ -54,7 +55,7 @@ scaffold = do
|
|||||||
| '0' <= c && c <= '9' = True
|
| '0' <= c && c <= '9' = True
|
||||||
validPN '-' = True
|
validPN '-' = True
|
||||||
validPN _ = False
|
validPN _ = False
|
||||||
project <- prompt $ all validPN
|
project <- prompt $ \s -> all validPN s && not (null s)
|
||||||
let dir = project
|
let dir = project
|
||||||
|
|
||||||
puts $(codegenDir "input" "site-arg")
|
puts $(codegenDir "input" "site-arg")
|
||||||
|
|||||||
@ -5,5 +5,10 @@ We recommend starting with SQLite: it has no dependencies.
|
|||||||
We have another option: a tiny project with minimal dependencies.
|
We have another option: a tiny project with minimal dependencies.
|
||||||
Mostly this means no database and no authentication.
|
Mostly this means no database and no authentication.
|
||||||
|
|
||||||
So, what'll it be?
|
s = sqlite
|
||||||
s for sqlite, p for postgresql, m for mongodb, or t for tiny:
|
p = postgresql
|
||||||
|
mongo = mongodb
|
||||||
|
t = tiny
|
||||||
|
mysql = MySQL (experimental)
|
||||||
|
|
||||||
|
So, what'll it be?
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user