mirror of
https://github.com/NixOS/nix
synced 2025-06-27 00:11:17 +02:00
* `nix-env -qa --description' shows human-readable descriptions of
packages (provided that they have a `meta.description' attribute). E.g., $ ./src/nix-env/nix-env -qa --description gcc gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for sparc-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for mips-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x (cross-compiler for arm-linux) gcc-4.0.2 GNU Compiler Collection, 4.0.x
This commit is contained in:
parent
a33fb2d287
commit
37d1b1cafd
7 changed files with 79 additions and 25 deletions
|
@ -390,14 +390,21 @@ static Expr primDirOf(EvalState & state, const ATermVector & args)
|
|||
}
|
||||
|
||||
|
||||
ATerm coerceToString(Expr e)
|
||||
{
|
||||
ATerm s;
|
||||
if (matchStr(e, s) || matchPath(e, s) || matchUri(e, s))
|
||||
return s;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* Convert the argument (which can be a path or a uri) to a string. */
|
||||
static Expr primToString(EvalState & state, const ATermVector & args)
|
||||
{
|
||||
Expr arg = evalExpr(state, args[0]);
|
||||
ATerm s;
|
||||
if (matchStr(arg, s) || matchPath(arg, s) || matchUri(arg, s))
|
||||
return makeStr(s);
|
||||
throw Error("cannot coerce value to string");
|
||||
ATerm s = coerceToString(evalExpr(state, args[0]));
|
||||
if (!s) throw Error("cannot coerce value to string");
|
||||
return makeStr(s);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue