1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-23 02:39:37 +01:00
nix/src/nix/show-config.cc
John Ericson cfe791a638 stdout_ -> cout
Better to get creative than just sprinkle arbitrary underscores.
2020-09-25 11:30:04 -04:00

33 lines
840 B
C++

#include "command.hh"
#include "common-args.hh"
#include "shared.hh"
#include "store-api.hh"
#include <nlohmann/json.hpp>
using namespace nix;
struct CmdShowConfig : Command, MixJSON
{
std::string description() override
{
return "show the Nix configuration";
}
Category category() override { return catUtility; }
void run() override
{
if (json) {
// FIXME: use appropriate JSON types (bool, ints, etc).
logger->cout("%s", globalConfig.toJSON().dump());
} else {
std::map<std::string, Config::SettingInfo> settings;
globalConfig.getSettings(settings);
for (auto & s : settings)
logger->cout("%s = %s", s.first, s.second.value);
}
}
};
static auto r1 = registerCommand<CmdShowConfig>("show-config");