1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-11 13:06:01 +01:00

Ask for confirmation before allowing flake Nix configuration settings

This commit is contained in:
Eelco Dolstra 2020-11-26 12:34:43 +01:00
parent 605bacdc92
commit 0287f83057
4 changed files with 53 additions and 32 deletions

View file

@ -466,6 +466,17 @@ public:
Logger::writeToStdout(s);
}
}
std::optional<char> ask(std::string_view msg) override
{
auto state(state_.lock());
if (!state->active || !isatty(STDIN_FILENO)) return {};
std::cerr << fmt("\r\e[K%s ", msg);
auto s = trim(readLine(STDIN_FILENO));
if (s.size() != 1) return {};
draw(*state);
return s[0];
}
};
Logger * makeProgressBar(bool printBuildLogs)