1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-09 18:41:03 +01:00

variadic args for hint format

This commit is contained in:
Ben Burdette 2020-04-03 08:48:20 -06:00
parent c6b3fcddb0
commit 7b7801d3f0
3 changed files with 30 additions and 16 deletions

View file

@ -33,8 +33,8 @@ int main()
printErrorInfo( ProgramWarning()
.name("warning name")
.description("warning description")
.hint(hintfmt("there was a %1%") %
"warning") // 'warning' will be yellow.
// the templated value, 'warning', is automatically colored yellow.
.hint(hintfmt("there was a %1%", "warning"))
);
/*
@ -67,8 +67,7 @@ int main()
.linesOfCode(std::nullopt,
"this is the problem line of code",
std::nullopt)
.hint(hintfmt("this hint has %1% templated %2%!!") %
"yellow" % "values"));
.hint(hintfmt("this hint has %1% templated %2%!!", "yellow" , "values")));
// NixLangError is just the same as NixLangWarning, except for the Error
// flag.
@ -81,8 +80,7 @@ int main()
.linesOfCode(std::optional("previous line of code"),
"this is the problem line of code",
std::optional("next line of code"))
.hint(hintfmt("this hint has %1% templated %2%!!") %
"yellow" % "values"));
.hint(hintfmt("this hint has %1% templated %2%!!", "yellow", "values")));
return 0;
}