Style tweaks

This commit is contained in:
Eelco Dolstra 2021-07-07 10:02:55 +02:00
parent e37ecd1282
commit 3b3e6bb1e5
4 changed files with 9 additions and 8 deletions

View file

@ -124,7 +124,7 @@ std::shared_ptr<Registry> getUserRegistry()
return userRegistry; return userRegistry;
} }
std::shared_ptr<Registry> getCustomRegistry(Path p) std::shared_ptr<Registry> getCustomRegistry(const Path & p)
{ {
static auto customRegistry = static auto customRegistry =
Registry::read(p, Registry::Custom); Registry::read(p, Registry::Custom);

View file

@ -49,7 +49,7 @@ typedef std::vector<std::shared_ptr<Registry>> Registries;
std::shared_ptr<Registry> getUserRegistry(); std::shared_ptr<Registry> getUserRegistry();
std::shared_ptr<Registry> getCustomRegistry(Path p); std::shared_ptr<Registry> getCustomRegistry(const Path & p);
Path getUserRegistryPath(); Path getUserRegistryPath();

View file

@ -24,7 +24,7 @@ R""(
``` ```
* Pin `nixpkgs` in a custom registry to its most recent Git revision * Pin `nixpkgs` in a custom registry to its most recent Git revision:
```console ```console
# nix registry pin --registry ./custom-flake-registry.json nixpkgs # nix registry pin --registry ./custom-flake-registry.json nixpkgs

View file

@ -11,13 +11,12 @@ using namespace nix;
using namespace nix::flake; using namespace nix::flake;
class RegistryCommand: virtual Args class RegistryCommand : virtual Args
{ {
std::string registry_path; std::string registry_path;
std::shared_ptr<fetchers::Registry> registry; std::shared_ptr<fetchers::Registry> registry;
public: public:
RegistryCommand() RegistryCommand()
@ -30,7 +29,8 @@ public:
}); });
} }
std::shared_ptr<fetchers::Registry> getRegistry() { std::shared_ptr<fetchers::Registry> getRegistry()
{
if (registry) return registry; if (registry) return registry;
if (registry_path.empty()) { if (registry_path.empty()) {
registry = fetchers::getUserRegistry(); registry = fetchers::getUserRegistry();
@ -40,7 +40,8 @@ public:
return registry; return registry;
} }
Path getRegistryPath() { Path getRegistryPath()
{
if (registry_path.empty()) { if (registry_path.empty()) {
return fetchers::getUserRegistryPath(); return fetchers::getUserRegistryPath();
} else { } else {
@ -156,7 +157,7 @@ struct CmdRegistryPin : RegistryCommand, EvalCommand
std::string description() override std::string description() override
{ {
return "pin a flake to its current version in user flake registry or to the current version of a flake URI"; return "pin a flake to its current version or to the current version of a flake URL";
} }
std::string doc() override std::string doc() override