1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-05 20:15:26 +03:00

Don't IFD when testing README

This commit is contained in:
Nicolas Mattia 2020-02-22 18:41:39 +01:00
parent 140dd34d49
commit f2e2502412
2 changed files with 24 additions and 25 deletions

View File

@ -223,7 +223,6 @@ Available commands:
modify Modify dependency attributes without performing an
update
drop Drop dependency
```
#### Add
@ -261,7 +260,6 @@ Available options:
Experimental commands:
git Add a git dependency. Experimental.
github Add a GitHub dependency
```
#### Update
@ -294,7 +292,6 @@ Available options:
'file' or 'tarball'. If not set, the value is
inferred from the suffix of the URL.
-h,--help Show this help text
```
#### Modify
@ -327,7 +324,6 @@ Available options:
'file' or 'tarball'. If not set, the value is
inferred from the suffix of the URL.
-h,--help Show this help text
```
#### Drop
@ -343,7 +339,6 @@ Usage: niv drop PACKAGE [ATTRIBUTE]
Available options:
-h,--help Show this help text
```
#### Init
@ -354,7 +349,6 @@ Usage: niv init
Available options:
-h,--help Show this help text
```
#### show
@ -364,7 +358,6 @@ Usage: niv show [PACKAGE]
Available options:
-h,--help Show this help text
```
[Nix]: https://nixos.org/nix/

View File

@ -195,24 +195,30 @@ rec
tests-github = pkgs.callPackage ./tests/github { inherit niv; };
tests-git = pkgs.callPackage ./tests/git { inherit niv; };
readme = pkgs.writeText "README.md" (
let
template = builtins.readFile ./README.tpl.md;
niv_help = builtins.readFile (
pkgs.runCommand "niv_help" { buildInputs = [ niv ]; }
"niv --help > $out"
);
niv_cmd_help = cmd: builtins.readFile (
pkgs.runCommand "niv_${cmd}_help" { buildInputs = [ niv ]; }
"niv ${cmd} --help > $out"
);
cmds = [ "add" "update" "modify" "drop" "init" "show" ];
in
pkgs.lib.replaceStrings
([ "replace_niv_help" ] ++ (map (cmd: "replace_niv_${cmd}_help") cmds))
([ niv_help ] ++ (map niv_cmd_help cmds))
template
);
readme = pkgs.runCommand "README.md" { nativeBuildInputs = [ niv ]; }
''
cp ${./README.tpl.md} $out
sed -i "/replace_niv_help/r"<(niv --help) $out
sed -i "/replace_niv_help/d" $out
sed -i "/replace_niv_add_help/r"<(niv add --help) $out
sed -i "/replace_niv_add_help/d" $out
sed -i "/replace_niv_update_help/r"<(niv update --help) $out
sed -i "/replace_niv_update_help/d" $out
sed -i "/replace_niv_modify_help/r"<(niv modify --help) $out
sed -i "/replace_niv_modify_help/d" $out
sed -i "/replace_niv_drop_help/r"<(niv drop --help) $out
sed -i "/replace_niv_drop_help/d" $out
sed -i "/replace_niv_init_help/r"<(niv init --help) $out
sed -i "/replace_niv_init_help/d" $out
sed -i "/replace_niv_show_help/r"<(niv show --help) $out
sed -i "/replace_niv_show_help/d" $out
'';
readme-test = pkgs.runCommand "README-test" {}
''