Skip to content

Commit

Permalink
nix add-to-store: Move markdown docs into a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Dec 3, 2020
1 parent c3c858a commit 1b0ca38
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
27 changes: 3 additions & 24 deletions src/nix/add-to-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,9 @@ struct CmdAddToStore : MixDryRun, StoreCommand

std::string doc() override
{
return R"(
# Description
Copy the file or directory *path* to the Nix store, and
print the resulting store path on standard output.
> **Warning**
>
> The resulting store path is not registered as a garbage
> collector root, so it could be deleted before you have a
> chance to register it.
# Examples
Add a regular file to the store:
```console
# echo foo > bar
# nix add-to-store --flat ./bar
/nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar
# cat /nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar
foo
```
)";
return
#include "add-to-store.md"
;
}

Category category() override { return catUtility; }
Expand Down
28 changes: 28 additions & 0 deletions src/nix/add-to-store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
R""(

# Description

Copy the file or directory *path* to the Nix store, and
print the resulting store path on standard output.

> **Warning**
>
> The resulting store path is not registered as a garbage
> collector root, so it could be deleted before you have a
> chance to register it.
# Examples

Add a regular file to the store:

```console
# echo foo > bar

# nix add-to-store --flat ./bar
/nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar

# cat /nix/store/cbv2s4bsvzjri77s2gb8g8bpcb6dpa8w-bar
foo
```

)""

0 comments on commit 1b0ca38

Please sign in to comment.