mirror of
https://github.com/nmattia/niv.git
synced 2024-11-07 22:36:53 +03:00
Generate README from niv
This commit is contained in:
parent
703d1b6408
commit
c8d451b153
1
Main.hs
1
Main.hs
@ -70,6 +70,7 @@ getVersionsSpec = do
|
||||
Just _ -> abortVersionsIsntAMap
|
||||
Nothing -> abortVersionsIsntJSON
|
||||
|
||||
-- TODO: pretty
|
||||
setVersionsSpec :: VersionsSpec -> IO ()
|
||||
setVersionsSpec versionsSpec = encodeFile pathNixVersionsJson versionsSpec
|
||||
|
||||
|
17
README.md
17
README.md
@ -34,6 +34,7 @@ Available commands:
|
||||
show
|
||||
update Update dependencies
|
||||
drop Drop dependency
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -48,13 +49,14 @@ Examples:
|
||||
|
||||
Usage: niv add PACKAGE ([-b|--branch BRANCH] | [-o|--owner OWNER] |
|
||||
[-r|--repo REPO] | [-v|--version VERSION] |
|
||||
[-a|--attribute KEY=VAL] | [-t|--template URL])
|
||||
[-n|--name NAME]
|
||||
[-a|--attribute KEY=VAL] | [-t|--template URL]) [-n|--name NAME]
|
||||
Add dependency
|
||||
|
||||
Available options:
|
||||
-t,--template URL foo
|
||||
-t,--template URL Used during 'update' when building URL. Occurrences
|
||||
of <foo> are replaced with attribute 'foo'.
|
||||
-h,--help Show this help text
|
||||
|
||||
```
|
||||
|
||||
|
||||
@ -67,14 +69,16 @@ Examples:
|
||||
niv update nixpkgs
|
||||
niv update my-package -v beta-0.2
|
||||
|
||||
Usage: niv update [PACKAGE] ([-b|--branch BRANCH] | [-o|--owner OWNER]
|
||||
| [-r|--repo REPO] | [-v|--version VERSION] |
|
||||
Usage: niv update [PACKAGE] ([-b|--branch BRANCH] | [-o|--owner OWNER] |
|
||||
[-r|--repo REPO] | [-v|--version VERSION] |
|
||||
[-a|--attribute KEY=VAL] | [-t|--template URL])
|
||||
Update dependencies
|
||||
|
||||
Available options:
|
||||
-t,--template URL foo
|
||||
-t,--template URL Used during 'update' when building URL. Occurrences
|
||||
of <foo> are replaced with attribute 'foo'.
|
||||
-h,--help Show this help text
|
||||
|
||||
```
|
||||
|
||||
### Drop
|
||||
@ -89,6 +93,7 @@ Usage: niv drop PACKAGE
|
||||
|
||||
Available options:
|
||||
-h,--help Show this help text
|
||||
|
||||
```
|
||||
|
||||
[Nix]: https://nixos.org/nix/
|
||||
|
46
README.tpl.md
Normal file
46
README.tpl.md
Normal file
@ -0,0 +1,46 @@
|
||||
# niv
|
||||
|
||||
A tool for dealing with third-party packages in [Nix].
|
||||
|
||||
## Building
|
||||
|
||||
Inside the provided nix shell:
|
||||
|
||||
``` bash
|
||||
$ # GHCi:
|
||||
$ snack ghci
|
||||
$ # run:
|
||||
$ snack run -- <args>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
* [Add](#add)
|
||||
* [Update](#update)
|
||||
* [Drop](#drop)
|
||||
|
||||
```
|
||||
replace_niv_help
|
||||
```
|
||||
|
||||
|
||||
### Add
|
||||
|
||||
```
|
||||
replace_niv_add_help
|
||||
```
|
||||
|
||||
|
||||
### Update
|
||||
|
||||
```
|
||||
replace_niv_update_help
|
||||
```
|
||||
|
||||
### Drop
|
||||
|
||||
```
|
||||
replace_niv_drop_help
|
||||
```
|
||||
|
||||
[Nix]: https://nixos.org/nix/
|
@ -1,2 +1,2 @@
|
||||
with { pkgs = import ./nix; };
|
||||
pkgs.niv
|
||||
{ inherit (pkgs) niv readme ; }
|
||||
|
@ -10,4 +10,39 @@
|
||||
(self: super:
|
||||
{ niv = super.snack-lib.executable ../package.yaml ; }
|
||||
)
|
||||
|
||||
(self: super:
|
||||
{ readme = self.writeText "README.md"
|
||||
(with
|
||||
{ template = builtins.readFile ../README.tpl.md;
|
||||
niv_help = builtins.readFile
|
||||
(self.runCommand "niv_help" { buildInputs = [ self.niv ]; }
|
||||
"niv --help > $out"
|
||||
);
|
||||
niv_add_help = builtins.readFile
|
||||
(self.runCommand "niv_add_help" { buildInputs = [ self.niv ]; }
|
||||
"niv add --help > $out"
|
||||
);
|
||||
niv_update_help = builtins.readFile
|
||||
(self.runCommand "niv_update_help" { buildInputs = [ self.niv ]; }
|
||||
"niv update --help > $out"
|
||||
);
|
||||
niv_drop_help = builtins.readFile
|
||||
(self.runCommand "niv_drop_help" { buildInputs = [ self.niv ]; }
|
||||
"niv drop --help > $out"
|
||||
);
|
||||
};
|
||||
self.lib.replaceStrings
|
||||
[
|
||||
"replace_niv_help"
|
||||
"replace_niv_add_help"
|
||||
"replace_niv_update_help"
|
||||
"replace_niv_drop_help"
|
||||
]
|
||||
[ niv_help niv_add_help niv_update_help niv_drop_help ]
|
||||
template
|
||||
);
|
||||
}
|
||||
)
|
||||
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user