From f2e2502412a661bc371c7390d86de278c4b9ef97 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Sat, 22 Feb 2020 18:41:39 +0100 Subject: [PATCH] Don't IFD when testing README --- README.md | 7 ------- default.nix | 42 ++++++++++++++++++++++++------------------ 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index f3db944..407631a 100644 --- a/README.md +++ b/README.md @@ -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/ diff --git a/default.nix b/default.nix index 53d5bff..7633431 100644 --- a/default.nix +++ b/default.nix @@ -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" {} ''