Solve huge bug
I should use tests someday.
This commit is contained in:
parent
44123e1443
commit
2abb1c9074
13
main.hs
13
main.hs
@ -9,7 +9,7 @@ import Alea.Diceware
|
|||||||
import Alea.Random
|
import Alea.Random
|
||||||
|
|
||||||
_NAME = "Alea"
|
_NAME = "Alea"
|
||||||
_VERSION = "0.2.0"
|
_VERSION = "0.2.1"
|
||||||
_INFO = _NAME ++ " version " ++ _VERSION
|
_INFO = _NAME ++ " version " ++ _VERSION
|
||||||
_ABOUT = "a diceware passphrase generator"
|
_ABOUT = "a diceware passphrase generator"
|
||||||
_COPYRIGHT = "(C) Michele Guerini Rocco 2014"
|
_COPYRIGHT = "(C) Michele Guerini Rocco 2014"
|
||||||
@ -44,12 +44,11 @@ main = getProgArgs >>= defaults >>= exec
|
|||||||
-- Assign default values to unspecified args
|
-- Assign default values to unspecified args
|
||||||
defaults :: Args -> IO Args
|
defaults :: Args -> IO Args
|
||||||
defaults args@Args{..} = do
|
defaults args@Args{..} = do
|
||||||
defaultDict <- getDataFileName "dict/diceware" >>= readFile
|
dictionary' <- if null dictionary
|
||||||
dict <- readFile dictionary
|
then getDataFileName "dict/diceware" >>= readFile
|
||||||
return args
|
else readFile dictionary
|
||||||
{ dictionary = if null dict then defaultDict else dict
|
let phraseLength' = if phraseLength == 0 then 6 else phraseLength
|
||||||
, phraseLength = if phraseLength == 0 then 6 else phraseLength
|
return args { dictionary = dictionary', phraseLength = phraseLength'}
|
||||||
}
|
|
||||||
|
|
||||||
-- Main function
|
-- Main function
|
||||||
exec :: Args -> IO ()
|
exec :: Args -> IO ()
|
||||||
|
Loading…
Reference in New Issue
Block a user