-- General Options

parseOptions :: IO (Parser Options)
parseOptions = do
  baseConfPath <- getXdgDirectory XdgConfig "lambdaPass"
  createDirectoryIfMissing True baseConfPath
  let configPath = baseConfPath </> "lambdaPass.yml"
  configExists <- doesFileExist configPath
  if configExists then return () else do
    newFile <- openFile configPath AppendMode
    hPutStrLn newFile "base:"
    hClose newFile
  config <- loadConfig configPath
  return $ Options <$> parseFile (join . fmap (passFile . base) $ config)
                   <*> parseFingerprint (join . fmap (gpgKey . base) $ config)
                   <*> parseKey (join . fmap (gpgDir . base) $ config)
                   <*> parseCommand
parseOptions :: IO (Parser Options)
parseOptions = do
  baseConfPath <- getXdgDirectory XdgConfig "lambdaPass"
  createDirectoryIfMissing True baseConfPath
  let configPath = baseConfPath </> "lambdaPass.yml"
  configExists <- doesFileExist configPath
  if configExists then return () else do
    newFile <- openFile configPath AppendMode
    hPutStrLn newFile "base:"
    hClose newFile
  config <- loadConfig configPath
  return $ Options <$> parseFile (join . fmap (passFile . base) $ config)
                   <*> parseFingerprint (join . fmap (gpgKey . base) $ config)
                   <*> parseKey (join . fmap (gpgDir . base) $ config)
                   <*> parseCommand
parseOptions = do
  baseConfPath <- getXdgDirectory XdgConfig "lambdaPass"
  createDirectoryIfMissing True baseConfPath
  let configPath = baseConfPath </> "lambdaPass.yml"
  configExists <- doesFileExist configPath
  if configExists then return () else do
    newFile <- openFile configPath AppendMode
    hPutStrLn newFile "base:"
    hClose newFile
  config <- loadConfig configPath
  return $ Options <$> parseFile (join . fmap (passFile . base) $ config)
                   <*> parseFingerprint (join . fmap (gpgKey . base) $ config)
                   <*> parseKey (join . fmap (gpgDir . base) $ config)
                   <*> parseCommand