mirror of
https://github.com/NixOS/nix.git
synced 2025-11-10 12:36:01 +01:00
dropEmptyInitThenConcatStringsSep -> concatStringSep: diagnostics and docs
These are non-critical, so their behavior is ok to change. Dropping empty items is not needed and usually not expected.
This commit is contained in:
parent
a681d354e7
commit
ea966a70fc
9 changed files with 28 additions and 16 deletions
|
|
@ -1,3 +1,5 @@
|
|||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "command.hh"
|
||||
#include "markdown.hh"
|
||||
#include "store-api.hh"
|
||||
|
|
@ -6,8 +8,7 @@
|
|||
#include "nixexpr.hh"
|
||||
#include "profiles.hh"
|
||||
#include "repl.hh"
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "strings.hh"
|
||||
|
||||
extern char * * environ __attribute__((weak));
|
||||
|
||||
|
|
@ -42,7 +43,7 @@ void NixMultiCommand::run()
|
|||
for (auto & [name, _] : commands)
|
||||
subCommandTextLines.insert(fmt("- `%s`", name));
|
||||
std::string markdownError = fmt("`nix %s` requires a sub-command. Available sub-commands:\n\n%s\n",
|
||||
commandName, dropEmptyInitThenConcatStringsSep("\n", subCommandTextLines));
|
||||
commandName, concatStringsSep("\n", subCommandTextLines));
|
||||
throw UsageError(renderMarkdownToTerminal(markdownError));
|
||||
}
|
||||
command->second->run();
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@
|
|||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "strings-inline.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
void completeFlakeInputPath(
|
||||
|
|
@ -630,7 +632,7 @@ static void throwBuildErrors(
|
|||
}
|
||||
failedPaths.insert(failedResult->path.to_string(store));
|
||||
}
|
||||
throw Error("build of %s failed", dropEmptyInitThenConcatStringsSep(", ", quoteStrings(failedPaths)));
|
||||
throw Error("build of %s failed", concatStringsSep(", ", quoteStrings(failedPaths)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@
|
|||
#include <gc/gc_cpp.h>
|
||||
#endif
|
||||
|
||||
#include "strings.hh"
|
||||
|
||||
namespace nix {
|
||||
|
||||
/**
|
||||
|
|
@ -625,7 +627,7 @@ ProcessLineResult NixRepl::processLine(std::string line)
|
|||
|
||||
markdown +=
|
||||
"**Synopsis:** `builtins." + (std::string) (*doc->name) + "` "
|
||||
+ dropEmptyInitThenConcatStringsSep(" ", args) + "\n\n";
|
||||
+ concatStringsSep(" ", args) + "\n\n";
|
||||
}
|
||||
|
||||
markdown += stripIndentation(doc->doc);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue