mirror of
https://github.com/NixOS/nix
synced 2025-07-07 10:11:47 +02:00
Merge remote-tracking branch 'origin/master' into detsys-main
This commit is contained in:
commit
042c2ae3ac
222 changed files with 3295 additions and 1254 deletions
|
@ -116,9 +116,12 @@ let
|
|||
storeInfo = commandInfo.stores;
|
||||
inherit inlineHTML;
|
||||
};
|
||||
hasInfix = infix: content:
|
||||
builtins.stringLength content != builtins.stringLength (replaceStrings [ infix ] [ "" ] content);
|
||||
in
|
||||
optionalString (details ? doc) (
|
||||
if match ".*@store-types@.*" details.doc != null
|
||||
# An alternate implementation with builtins.match stack overflowed on some systems.
|
||||
if hasInfix "@store-types@" details.doc
|
||||
then help-stores
|
||||
else details.doc
|
||||
);
|
||||
|
|
53
doc/manual/rl-next/repl-doc-renders-doc-comments.md
Normal file
53
doc/manual/rl-next/repl-doc-renders-doc-comments.md
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
synopsis: "`nix-repl`'s `:doc` shows documentation comments"
|
||||
significance: significant
|
||||
issues:
|
||||
- 3904
|
||||
- 10771
|
||||
prs:
|
||||
- 1652
|
||||
- 9054
|
||||
- 11072
|
||||
---
|
||||
|
||||
`nix repl` has a `:doc` command that previously only rendered documentation for internally defined functions.
|
||||
This feature has been extended to also render function documentation comments, in accordance with [RFC 145].
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
nix-repl> :doc lib.toFunction
|
||||
Function toFunction
|
||||
… defined at /home/user/h/nixpkgs/lib/trivial.nix:1072:5
|
||||
|
||||
Turns any non-callable values into constant functions. Returns
|
||||
callable values as is.
|
||||
|
||||
Inputs
|
||||
|
||||
v
|
||||
|
||||
: Any value
|
||||
|
||||
Examples
|
||||
|
||||
:::{.example}
|
||||
|
||||
## lib.trivial.toFunction usage example
|
||||
|
||||
| nix-repl> lib.toFunction 1 2
|
||||
| 1
|
||||
|
|
||||
| nix-repl> lib.toFunction (x: x + 1) 2
|
||||
| 3
|
||||
|
||||
:::
|
||||
```
|
||||
|
||||
Known limitations:
|
||||
- It does not render documentation for "formals", such as `{ /** the value to return */ x, ... }: x`.
|
||||
- Some extensions to markdown are not yet supported, as you can see in the example above.
|
||||
|
||||
We'd like to acknowledge Yingchi Long for proposing a proof of concept for this functionality in [#9054](https://github.com/NixOS/nix/pull/9054), as well as @sternenseemann and Johannes Kirschbauer for their contributions, proposals, and their work on [RFC 145].
|
||||
|
||||
[RFC 145]: https://github.com/NixOS/rfcs/pull/145
|
|
@ -91,7 +91,7 @@ A environment variables that Google Test accepts are also worth knowing:
|
|||
Putting the two together, one might run
|
||||
|
||||
```bash
|
||||
GTEST_BREIF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v
|
||||
GTEST_BRIEF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v
|
||||
```
|
||||
|
||||
for short but comprensive output.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue