mirror of
https://github.com/nmattia/niv.git
synced 2024-09-21 04:17:11 +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
|
Just _ -> abortVersionsIsntAMap
|
||||||
Nothing -> abortVersionsIsntJSON
|
Nothing -> abortVersionsIsntJSON
|
||||||
|
|
||||||
|
-- TODO: pretty
|
||||||
setVersionsSpec :: VersionsSpec -> IO ()
|
setVersionsSpec :: VersionsSpec -> IO ()
|
||||||
setVersionsSpec versionsSpec = encodeFile pathNixVersionsJson versionsSpec
|
setVersionsSpec versionsSpec = encodeFile pathNixVersionsJson versionsSpec
|
||||||
|
|
||||||
|
21
README.md
21
README.md
@ -34,6 +34,7 @@ Available commands:
|
|||||||
show
|
show
|
||||||
update Update dependencies
|
update Update dependencies
|
||||||
drop Drop dependency
|
drop Drop dependency
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -47,14 +48,15 @@ Examples:
|
|||||||
niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip
|
niv add my-package -v alpha-0.1 -t http://example.com/archive/<version>.zip
|
||||||
|
|
||||||
Usage: niv add PACKAGE ([-b|--branch BRANCH] | [-o|--owner OWNER] |
|
Usage: niv add PACKAGE ([-b|--branch BRANCH] | [-o|--owner OWNER] |
|
||||||
[-r|--repo REPO] | [-v|--version VERSION] |
|
[-r|--repo REPO] | [-v|--version VERSION] |
|
||||||
[-a|--attribute KEY=VAL] | [-t|--template URL])
|
[-a|--attribute KEY=VAL] | [-t|--template URL]) [-n|--name NAME]
|
||||||
[-n|--name NAME]
|
|
||||||
Add dependency
|
Add dependency
|
||||||
|
|
||||||
Available options:
|
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
|
-h,--help Show this help text
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
@ -67,14 +69,16 @@ Examples:
|
|||||||
niv update nixpkgs
|
niv update nixpkgs
|
||||||
niv update my-package -v beta-0.2
|
niv update my-package -v beta-0.2
|
||||||
|
|
||||||
Usage: niv update [PACKAGE] ([-b|--branch BRANCH] | [-o|--owner OWNER]
|
Usage: niv update [PACKAGE] ([-b|--branch BRANCH] | [-o|--owner OWNER] |
|
||||||
| [-r|--repo REPO] | [-v|--version VERSION] |
|
[-r|--repo REPO] | [-v|--version VERSION] |
|
||||||
[-a|--attribute KEY=VAL] | [-t|--template URL])
|
[-a|--attribute KEY=VAL] | [-t|--template URL])
|
||||||
Update dependencies
|
Update dependencies
|
||||||
|
|
||||||
Available options:
|
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
|
-h,--help Show this help text
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Drop
|
### Drop
|
||||||
@ -89,6 +93,7 @@ Usage: niv drop PACKAGE
|
|||||||
|
|
||||||
Available options:
|
Available options:
|
||||||
-h,--help Show this help text
|
-h,--help Show this help text
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[Nix]: https://nixos.org/nix/
|
[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; };
|
with { pkgs = import ./nix; };
|
||||||
pkgs.niv
|
{ inherit (pkgs) niv readme ; }
|
||||||
|
@ -10,4 +10,39 @@
|
|||||||
(self: super:
|
(self: super:
|
||||||
{ niv = super.snack-lib.executable ../package.yaml ; }
|
{ 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