darcs-2.14.4: a distributed, interactive, smart revision control system

Safe HaskellNone




applyDefaults :: Maybe String -> DarcsCommand pf -> AbsolutePath -> [String] -> [String] -> [DarcsFlag] -> ([DarcsFlag], [String]) Source #

Apply defaults from all sources to a list of DarcsFlags (e.g. from the command line), given the command (and possibly super command) name, and a list of all options for the command.

Sources for defaults are

  • the builtin (hard-coded) defaults,
  • the defaults file in the user's configuration, and
  • the defaults file in the current repository.

Note that the pseudo command ALL is allowed in defaults files to specify that an option should be the default for all commands to which it applies.

The order of precedence for conflicting options (i.e. those belonging to same group of mutually exclusive options) is from less specific to more specific. In other words, options from the command line override all defaults, per-repo defaults override per-user defaults, which in turn override the built-in defaults. Inside the options from a defaults file, options for the given command override options for the ALL pseudo command.

Conflicting options at the same level of precedence are not allowed.

Errors encountered during processing of command line or defaults flags are formatted and added as (separate) strings to the list of error messages that are returned together with the resulting flag list.