Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Helper functions to access option contents. Some of them are here only to ease the transition from the legacy system where we manually parsed the flag list to the new(er) option system. At some point this module should be renamed and the re-exports from Darcs.UI.Options.All removed.
Synopsis
- data DarcsFlag
- diffingOpts :: Config -> DiffOpts
- wantGuiPause :: Config -> WantGuiPause
- isInteractive :: Bool -> Config -> Bool
- willRemoveLogFile :: Config -> Bool
- setDefault :: Bool -> Config -> SetDefault
- allowConflicts :: Config -> AllowConflicts
- hasXmlOutput :: Config -> Bool
- hasLogfile :: Config -> Maybe AbsolutePath
- quiet :: Config -> Bool
- verbose :: Config -> Bool
- enumeratePatches :: Config -> Bool
- fixUrl :: AbsolutePath -> String -> IO String
- pathsFromArgs :: (AbsolutePath, AbsolutePath) -> [String] -> IO [AnchoredPath]
- pathSetFromArgs :: (AbsolutePath, AbsolutePath) -> [String] -> IO (Maybe [AnchoredPath])
- getRepourl :: Config -> Maybe String
- getAuthor :: Maybe String -> Bool -> IO String
- promptAuthor :: Bool -> Bool -> IO String
- getEasyAuthor :: IO [String]
- getSendmailCmd :: Config -> IO (Maybe String)
- fileHelpAuthor :: [String]
- environmentHelpEmail :: ([String], [String])
- getSubject :: Config -> Maybe String
- getInReplyTo :: Config -> Maybe String
- getCc :: Config -> String
- environmentHelpSendmail :: ([String], [String])
- getOutput :: Config -> IO FilePath -> Maybe (IO AbsolutePathOrStd)
- getDate :: Bool -> IO String
- workRepo :: Config -> WorkRepo
- withNewRepo :: String -> Config -> Config
- diffAlgorithm :: PrimDarcsOption DiffAlgorithm
- reorder :: PrimDarcsOption Reorder
- minimize :: PrimDarcsOption Bool
- editDescription :: PrimDarcsOption Bool
- maxCount :: PrimDarcsOption (Maybe Int)
- matchAny :: MatchOption
- withContext :: PrimDarcsOption WithContext
- allowCaseDifferingFilenames :: PrimDarcsOption Bool
- allowWindowsReservedFilenames :: PrimDarcsOption Bool
- changesReverse :: PrimDarcsOption Bool
- usePacks :: PrimDarcsOption Bool
- onlyToFiles :: PrimDarcsOption Bool
- amendUnrecord :: PrimDarcsOption Bool
- verbosity :: PrimDarcsOption Verbosity
- useCache :: PrimDarcsOption UseCache
- useIndex :: PrimDarcsOption UseIndex
- umask :: PrimDarcsOption UMask
- dryRun :: PrimDarcsOption DryRun
- testChanges :: PrimDarcsOption TestChanges
- setScriptsExecutable :: PrimDarcsOption SetScriptsExecutable
- withWorkingDir :: PrimDarcsOption WithWorkingDir
- leaveTestDir :: PrimDarcsOption LeaveTestDir
- cloneKind :: PrimDarcsOption CloneKind
- patchIndexNo :: PrimDarcsOption WithPatchIndex
- patchIndexYes :: PrimDarcsOption WithPatchIndex
- xmlOutput :: PrimDarcsOption XmlOutput
- selectDeps :: PrimDarcsOption SelectDeps
- author :: PrimDarcsOption (Maybe String)
- patchFormat :: PrimDarcsOption PatchFormat
- charset :: PrimDarcsOption (Maybe String)
- siblings :: PrimDarcsOption [AbsolutePath]
- applyAs :: PrimDarcsOption (Maybe String)
- enumPatches :: PrimDarcsOption EnumPatches
Documentation
The DarcsFlag
type is a list of all flags that can ever be
passed to darcs, or to one of its commands.
Instances
diffingOpts :: Config -> DiffOpts Source #
wantGuiPause :: Config -> WantGuiPause Source #
This will become dis-entangled as soon as we inline these functions.
isInteractive :: Bool -> Config -> Bool Source #
Non-trivial interaction between options. Explicit -i
or -a
dominates,
else --count
, --xml
, or --dry-run
imply -a
, else use the def argument.
willRemoveLogFile :: Config -> Bool Source #
setDefault :: Bool -> Config -> SetDefault Source #
hasXmlOutput :: Config -> Bool Source #
hasLogfile :: Config -> Maybe AbsolutePath Source #
enumeratePatches :: Config -> Bool Source #
fixUrl :: AbsolutePath -> String -> IO String Source #
The first argument is an AbsolutePath
, the second a String
that may be
a file path or a URL. It returns either the URL, or an absolute version of
the path, interpreted relative to the first argument.
pathsFromArgs :: (AbsolutePath, AbsolutePath) -> [String] -> IO [AnchoredPath] Source #
Used by commands that expect arguments to be paths in the current repo. Invalid paths are dropped and a warning is issued. This may leave no valid paths to return. Although these commands all fail if there are no remaining valid paths, they do so in various different ways, issuing error messages tailored to the command.
pathSetFromArgs :: (AbsolutePath, AbsolutePath) -> [String] -> IO (Maybe [AnchoredPath]) Source #
Used by commands that interpret a set of optional path arguments as
"restrict to these paths", which affects patch selection (e.g. in log
command) or selection of subtrees (e.g. in record). Because of the special
meaning of "no arguments", we must distinguish it from "no valid arguments".
A result of Nothing
here means "no restriction to the set of paths". If
Just
is returned, the set is guaranteed to be non-empty.
getRepourl :: Config -> Maybe String Source #
getRepourl
takes a list of flags and returns the url of the
repository specified by Repodir "directory"
in that list of flags, if any.
This flag is present if darcs was invoked with --repodir=DIRECTORY
getAuthor :: Maybe String -> Bool -> IO String Source #
getAuthor
takes a list of flags and returns the author of the
change specified by Author "Leo Tolstoy"
in that list of flags, if any.
Otherwise, if Pipe
is present, asks the user who is the author and
returns the answer. If neither are present, try to guess the author,
from repository or global preference files or environment variables,
and if it's not possible, ask the user.
promptAuthor :: Bool -> Bool -> IO String Source #
promptAuthor
try to guess the author, from repository or
global preference files or environment variables, and
if it's not possible or alwaysAsk parameter is true, ask the user.
If store parameter is true, the new author is added into
_darcs/prefs
.
getEasyAuthor :: IO [String] Source #
getEasyAuthor
tries to get the author name first from the repository
preferences, then from global preferences, then from environment variables.
Returns []
if it could not get it. Note that it may only return multiple
possibilities when reading from global preferences.
getSendmailCmd :: Config -> IO (Maybe String) Source #
getSendmailCmd
takes a list of flags and returns the sendmail command
to be used by darcs send
. Looks for a command specified by
SendmailCmd "command"
in that list of flags, if any.
This flag is present if darcs was invoked with --sendmail-command=COMMAND
Alternatively the user can set $S
ENDMAIL
which will be used as a
fallback if present.
fileHelpAuthor :: [String] Source #
environmentHelpEmail :: ([String], [String]) Source #
getSubject :: Config -> Maybe String Source #
getSubject
takes a list of flags and returns the subject of the mail
to be sent by darcs send
. Looks for a subject specified by
Subject "subject"
in that list of flags, if any.
This flag is present if darcs was invoked with --subject=SUBJECT
getCc :: Config -> String Source #
getCc
takes a list of flags and returns the addresses to send a copy of
the patch bundle to when using darcs send
.
looks for a cc address specified by Cc "address"
in that list of flags.
Returns the addresses as a comma separated string.
environmentHelpSendmail :: ([String], [String]) Source #
getOutput :: Config -> IO FilePath -> Maybe (IO AbsolutePathOrStd) Source #
Accessor for output option. Takes and returns IO actions so that the default value is only calculated if needed, as it might involve filesystem actions that can fail.
Re-exports
reorder :: PrimDarcsOption Reorder Source #
pull, apply, rebase pull, rebase apply
onlyToFiles :: PrimDarcsOption Bool Source #
TODO: see issue2395
dryRun :: PrimDarcsOption DryRun Source #
TODO someone wrote here long ago that any time --dry-run is a possibility automated users should be able to examine the results more easily with --xml. See also issue2397. dryRun w/o xml is currently used in add, pull, and repair.
withWorkingDir :: PrimDarcsOption WithWorkingDir Source #
convert, clone, init