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;
}
std::shared_ptr<Registry> getCustomRegistry(Path p)
std::shared_ptr<Registry> getCustomRegistry(const Path & p)
{
static auto customRegistry =
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> getCustomRegistry(Path p);
std::shared_ptr<Registry> getCustomRegistry(const Path & p);
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
# nix registry pin --registry ./custom-flake-registry.json nixpkgs

View File

@ -11,13 +11,12 @@ using namespace nix;
using namespace nix::flake;
class RegistryCommand: virtual Args
class RegistryCommand : virtual Args
{
std::string registry_path;
std::shared_ptr<fetchers::Registry> registry;
public:
RegistryCommand()
@ -30,7 +29,8 @@ public:
});
}
std::shared_ptr<fetchers::Registry> getRegistry() {
std::shared_ptr<fetchers::Registry> getRegistry()
{
if (registry) return registry;
if (registry_path.empty()) {
registry = fetchers::getUserRegistry();
@ -40,7 +40,8 @@ public:
return registry;
}
Path getRegistryPath() {
Path getRegistryPath()
{
if (registry_path.empty()) {
return fetchers::getUserRegistryPath();
} else {
@ -156,7 +157,7 @@ struct CmdRegistryPin : RegistryCommand, EvalCommand
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