darcs-2.18.3: a distributed, interactive, smart revision control system
Safe HaskellSafe-Inferred
LanguageHaskell2010

Darcs.UI.Flags

Contents

Description

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

Documentation

data DarcsFlag Source #

The DarcsFlag type is a list of all flags that can ever be passed to darcs, or to one of its commands.

Instances

Instances details
Show DarcsFlag Source # 
Instance details

Defined in Darcs.UI.Options.Flags

Eq DarcsFlag Source # 
Instance details

Defined in Darcs.UI.Options.Flags

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.

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 $SENDMAIL which will be used as a fallback if present.

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.

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

matchAny :: MatchOption Source #

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.