nix eval: Add examples
This commit is contained in:
parent
2ebeffcfd4
commit
4967f0509a
1 changed files with 18 additions and 0 deletions
|
@ -27,6 +27,24 @@ struct CmdEval : MixJSON, InstallablesCommand
|
||||||
return "evaluate a Nix expression";
|
return "evaluate a Nix expression";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Examples examples() override
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
Example{
|
||||||
|
"To evaluate a Nix expression given on the command line:",
|
||||||
|
"nix eval '(1 + 2)'"
|
||||||
|
},
|
||||||
|
Example{
|
||||||
|
"To evaluate a Nix expression from a file or URI:",
|
||||||
|
"nix eval -f channel:nixos-17.09 hello.name"
|
||||||
|
},
|
||||||
|
Example{
|
||||||
|
"To get the current version of Nixpkgs:",
|
||||||
|
"nix eval --raw nixpkgs.lib.nixpkgsVersion"
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
if (raw && json)
|
if (raw && json)
|
||||||
|
|
Loading…
Reference in a new issue