mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
manual: update options generation code to use default values
This commit is contained in:
parent
11b5cf9561
commit
b44df13701
2 changed files with 5 additions and 12 deletions
|
@ -11,16 +11,16 @@ concatStrings (map
|
||||||
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
|
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
|
||||||
+ (if option.documentDefault
|
+ (if option.documentDefault
|
||||||
then " **Default:** " + (
|
then " **Default:** " + (
|
||||||
if option.value == "" || option.value == []
|
if option.defaultValue == "" || option.defaultValue == []
|
||||||
then "*empty*"
|
then "*empty*"
|
||||||
else if isBool option.value
|
else if isBool option.defaultValue
|
||||||
then (if option.value then "`true`" else "`false`")
|
then (if option.defaultValue then "`true`" else "`false`")
|
||||||
else
|
else
|
||||||
# n.b. a StringMap value type is specified as a string, but
|
# n.b. a StringMap value type is specified as a string, but
|
||||||
# this shows the value type. The empty stringmap is "null" in
|
# this shows the value type. The empty stringmap is "null" in
|
||||||
# JSON, but that converts to "{ }" here.
|
# JSON, but that converts to "{ }" here.
|
||||||
(if isAttrs option.value then "`\"\"`"
|
(if isAttrs option.defaultValue then "`\"\"`"
|
||||||
else "`" + toString option.value + "`")) + "\n\n"
|
else "`" + toString option.defaultValue + "`")) + "\n\n"
|
||||||
else " **Default:** *machine-specific*\n")
|
else " **Default:** *machine-specific*\n")
|
||||||
+ (if option.aliases != []
|
+ (if option.aliases != []
|
||||||
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
||||||
|
|
|
@ -369,13 +369,6 @@ void mainWrapped(int argc, char * * argv)
|
||||||
&& args.command->first != "upgrade-nix")
|
&& args.command->first != "upgrade-nix")
|
||||||
settings.requireExperimentalFeature(Xp::NixCommand);
|
settings.requireExperimentalFeature(Xp::NixCommand);
|
||||||
|
|
||||||
if (args.command->first == "show-config") {
|
|
||||||
// show-config must run before any settings are modified so that it outputs the defaults
|
|
||||||
args.command->second->prepare();
|
|
||||||
args.command->second->run();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.useNet && !haveInternet()) {
|
if (args.useNet && !haveInternet()) {
|
||||||
warn("you don't have Internet access; disabling some network-dependent features");
|
warn("you don't have Internet access; disabling some network-dependent features");
|
||||||
args.useNet = false;
|
args.useNet = false;
|
||||||
|
|
Loading…
Reference in a new issue