Do show aliases in the manual.

This commit is contained in:
Eelco Dolstra 2013-10-23 18:58:05 +02:00
parent b218c02a3c
commit caf18545a4

View File

@ -9,23 +9,24 @@ let
name = "Alias"; name = "Alias";
use = id; use = id;
define = id; define = id;
visible = true;
}; };
obsolete = from: to: rename { obsolete = from: to: rename {
inherit from to; inherit from to;
name = "Obsolete name"; name = "Obsolete name";
use = x: builtins.trace "Obsolete option ${showOption from} is used instead of ${showOption to}." x; use = x: builtins.trace "Obsolete option `${showOption from}' is used instead of `${showOption to}'." x;
define = x: builtins.trace "Obsolete option ${showOption from} is defined instead of ${showOption to}." x; define = x: builtins.trace "Obsolete option `${showOption from}' is defined instead of `${showOption to}'." x;
}; };
deprecated = from: to: rename { deprecated = from: to: rename {
inherit from to; inherit from to;
name = "Deprecated name"; name = "Deprecated name";
use = x: abort "Deprecated option ${showOption from} is used instead of ${showOption to}."; use = x: abort "Deprecated option `${showOption from}' is used instead of `${showOption to}'.";
define = x: abort "Deprecated option ${showOption from} is defined instead of ${showOption to}."; define = x: abort "Deprecated option `${showOption from}' is defined instead of `${showOption to}'.";
}; };
showOption = name: "`${concatStringsSep "." name}'"; showOption = concatStringsSep ".";
zipModules = list: zipModules = list:
zipAttrsWith (n: v: zipAttrsWith (n: v:
@ -39,18 +40,19 @@ let
else head v else head v
) list; ) list;
rename = { from, to, name, use, define }: rename = { from, to, name, use, define, visible ? false }:
let let
setTo = setAttrByPath to; setTo = setAttrByPath to;
setFrom = setAttrByPath from; setFrom = setAttrByPath from;
toOf = attrByPath to toOf = attrByPath to
(abort "Renaming error: option ${showOption to} does not exists."); (abort "Renaming error: option `${showOption to}' does not exists.");
fromOf = attrByPath from fromOf = attrByPath from
(abort "Internal error: option ${showOption from} should be declared."); (abort "Internal error: option `${showOption from}' should be declared.");
in in
[ { options = setFrom (mkOption { [ { options = setFrom (mkOption {
description = "${name} of <option>${showOption to}</option>.";
apply = x: use (toOf config); apply = x: use (toOf config);
visible = false; inherit visible;
}); });
} }
{ options = setTo (mkOption { { options = setTo (mkOption {
@ -68,7 +70,7 @@ let
visible = false; visible = false;
}); });
config.warnings = optional (getAttrFromPath option config != null) config.warnings = optional (getAttrFromPath option config != null)
"The option ${showOption option} defined in your configuration no longer has any effect; please remove it."; "The option `${showOption option}' defined in your configuration no longer has any effect; please remove it.";
}; };
in zipModules ([] in zipModules ([]