mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-24 03:54:43 +03:00
Update src/System/Hapistrano.hs
Co-authored-by: Cristhian Motoche <CristhianMotoche@users.noreply.github.com>
This commit is contained in:
parent
de1c4235f9
commit
5b56f2fc9c
@ -292,15 +292,13 @@ initConfig getLine' = do
|
||||
prompt :: Show a => String -> a -> MParser a -> IO a
|
||||
prompt parameterName def parser = do
|
||||
userInput <- prompt' (parameterName <> " (default: " <> show def <> ")")
|
||||
if null userInput then
|
||||
when (null userInput)
|
||||
pure def
|
||||
else do
|
||||
let parsed = M.parse (parser <* M.eof) "" userInput
|
||||
case parsed of
|
||||
Left err -> do
|
||||
hPutStrLn stderr (M.errorBundlePretty err)
|
||||
prompt parameterName def parser
|
||||
Right res -> pure res
|
||||
|
||||
either
|
||||
(\err -> hPutStrLn stderr (M.errorBundlePretty err) >> prompt parameterName def parser)
|
||||
pure
|
||||
(M.parse (parser <* M.eof) "" userInput)
|
||||
|
||||
promptYN = do
|
||||
userInput <- prompt "Include restart command? y/N" 'N' yNParser
|
||||
|
Loading…
Reference in New Issue
Block a user