-- parseFields takes a string that contains the default fields you wish to display.
-- It then returns the fields the user requested or that you set as default.
parseFields
  :: String
  -> Parser [AccountFields]
parseFields def =
  foldr f [] <$> strOption (short 'f' <> long "fields" <> value def <> metavar "FIELDS"
  <> help ("These are the account fields you wish displayed. Use 'u' for user, 'l' for location "
  ++ "'n' for notes and 'p' for password. Default behavior will be to just show password."))
  where f x acc = case x of
                    'u' -> UserField  : acc
                    'p' -> PassField  : acc
                    'l' -> LocField   : acc
                    'n' -> NotesField : acc
                    _ -> acc
parseFields
  :: String
  -> Parser [AccountFields]
parseFields def =
  foldr f [] <$> strOption (short 'f' <> long "fields" <> value def <> metavar "FIELDS"
  <> help ("These are the account fields you wish displayed. Use 'u' for user, 'l' for location "
  ++ "'n' for notes and 'p' for password. Default behavior will be to just show password."))
  where f x acc = case x of
                    'u' -> UserField  : acc
                    'p' -> PassField  : acc
                    'l' -> LocField   : acc
                    'n' -> NotesField : acc
                    _ -> acc
parseFields def =
  foldr f [] <$> strOption (short 'f' <> long "fields" <> value def <> metavar "FIELDS"
  <> help ("These are the account fields you wish displayed. Use 'u' for user, 'l' for location "
  ++ "'n' for notes and 'p' for password. Default behavior will be to just show password."))
  where f x acc = case x of
                    'u' -> UserField  : acc
                    'p' -> PassField  : acc
                    'l' -> LocField   : acc
                    'n' -> NotesField : acc
                    _ -> acc