-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Parser for .netrc files -- @package netrc @version 0.2.0.0 -- | Provides parser for $HOME/.netrc files -- -- The implemented grammar is approximately: -- --
-- NETRC := (WS|<comment>)* (ENTRY (WS+ <comment>*)+)* ENTRY?
--
-- ENTRY := 'machine' WS+ <value> WS+ ((account|username|password) WS+ <value>)*
-- | 'default' WS+ (('account'|'username'|'password') WS+ <value>)*
-- | 'macdef' <value> LF (<line> LF)* LF
--
-- WS := (LF|SPC|TAB)
--
-- <line> := !LF+
-- <value> := !WS+
-- <comment> := '#' !LF* LF
--
--
-- As an extension to the .netrc-format as described in .e.g.
-- netrc(5), #-style comments are tolerated. Comments are
-- currently only allowed before, between, and after
-- machine/default/macdef entries. Be aware
-- though that such #-comment are not supported by all
-- .netrc-aware applications, including ftp(1).
module Network.NetRc
-- | Represents (semantic) contents of a .netrc file
data NetRc
NetRc :: [NetRcHost] -> [NetRcMacDef] -> NetRc
-- | machine/default entries
--
-- Note: If it exists, the default entry ought to be the
-- last entry, otherwise it can cause later entries to become invisible
-- for some implementations (e.g. ftp(1))
nrHosts :: NetRc -> [NetRcHost]
-- | Non-associated macdef entries
--
-- Note: macdef entries not associated with host-entries
-- are invisible to some applications (e.g. ftp(1)).
nrMacros :: NetRc -> [NetRcMacDef]
-- | machine and default entries describe remote accounts
--
-- Invariant: fields must not contain any TABs,
-- SPACE, or LFs.
data NetRcHost
NetRcHost :: !ByteString -> !ByteString -> !ByteString -> !ByteString -> [NetRcMacDef] -> NetRcHost
-- | Remote machine name ("" for default-entries)
nrhName :: NetRcHost -> !ByteString
-- | login property ("" if missing)
nrhLogin :: NetRcHost -> !ByteString
-- | password property ("" if missing)
nrhPassword :: NetRcHost -> !ByteString
-- | account property ("" if missing)
nrhAccount :: NetRcHost -> !ByteString
-- | associated macdef entries
nrhMacros :: NetRcHost -> [NetRcMacDef]
-- | macdef entries defining ftp macros
data NetRcMacDef
NetRcMacDef :: !ByteString -> !ByteString -> NetRcMacDef
-- | Name of macdef entry
--
-- Invariant: must not contain any TABs, SPACE,
-- or LFs
nrmName :: NetRcMacDef -> !ByteString
-- | Raw macdef body
--
-- Invariant: must not contain null-lines, i.e. consecutive
-- LFs
nrmBody :: NetRcMacDef -> !ByteString
-- | Construct a ByteString Builder
netRcToBuilder :: NetRc -> Builder
-- | Format NetRc into a ByteString
--
-- This is currently just a convenience wrapper around
-- netRcToBuilder
netRcToByteString :: NetRc -> ByteString
-- | Text.Parsec.ByteString Parser for .netrc
-- grammar
netRcParsec :: Parser NetRc
-- | Convenience wrapper for netRcParsec parser
--
-- This is basically just
--
-- -- parseNetRc = parse (netRcParsec <* eof) ---- -- This wrapper is mostly useful for avoiding to have to import Parsec -- modules (and to build-depend explicitly on parsec). parseNetRc :: SourceName -> ByteString -> Either ParseError NetRc -- | Reads and parses default $HOME/.netrc -- -- Returns Nothing if $HOME variable undefined and/or if -- .netrc if missing. Throws standard IO exceptions in case of -- other filesystem-errors. -- -- Note: This function performs no permission sanity-checking on -- the .netrc file readUserNetRc :: IO (Maybe (Either ParseError NetRc)) instance Typeable NetRcMacDef instance Typeable NetRcHost instance Typeable NetRc instance Eq NetRcMacDef instance Ord NetRcMacDef instance Show NetRcMacDef instance Data NetRcMacDef instance Generic NetRcMacDef instance Eq NetRcHost instance Ord NetRcHost instance Show NetRcHost instance Data NetRcHost instance Generic NetRcHost instance Eq NetRc instance Ord NetRc instance Show NetRc instance Data NetRc instance Generic NetRc instance Show PVal instance Datatype D1NetRcMacDef instance Constructor C1_0NetRcMacDef instance Selector S1_0_0NetRcMacDef instance Selector S1_0_1NetRcMacDef instance Datatype D1NetRcHost instance Constructor C1_0NetRcHost instance Selector S1_0_0NetRcHost instance Selector S1_0_1NetRcHost instance Selector S1_0_2NetRcHost instance Selector S1_0_3NetRcHost instance Selector S1_0_4NetRcHost instance Datatype D1NetRc instance Constructor C1_0NetRc instance Selector S1_0_0NetRc instance Selector S1_0_1NetRc instance NFData NetRc instance NFData NetRcMacDef instance NFData NetRcHost