Repository: swellaby/rusty-hook
Pull request #121 (2020-09-26 03:15:16)

deps: bump to nias v0.7.0
## Changes
<!-- Summary of changes included in this PR -->
- [x] Updates nias to v0.7.0 to get support for setting environment variables for the command runner
- [x] Add a test util function for generating the stub closure since the signature's starting to get gnarly

## Related Issues
<!-- List any related/impacted issues -->
- Refs #25 
- Refs #113 



Patch:
diff --git a/Cargo.lock b/Cargo.lock
index c2dd78f..34f626d 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4,301 +4,299 @@
 name = "atty"
 version = "0.2.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
 dependencies = [
- "hermit-abi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "hermit-abi",
+ "libc",
+ "winapi",
 ]
 
 [[package]]
 name = "autocfg"
 version = "1.0.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
 
 [[package]]
 name = "bitflags"
 version = "1.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
 
 [[package]]
 name = "ci_info"
 version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "d240a3b5a8a7cb577fa8d595d8ec30828b252a58d477b4ae3309b9603204c3b5"
 dependencies = [
- "envmnt 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "envmnt",
 ]
 
 [[package]]
 name = "clap"
 version = "3.0.0-beta.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
 dependencies = [
- "atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
- "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "clap_derive 3.0.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "indexmap 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "os_str_bytes 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "strsim 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "textwrap 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
- "vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "atty",
+ "bitflags",
+ "clap_derive",
+ "indexmap",
+ "lazy_static",
+ "os_str_bytes",
+ "strsim",
+ "termcolor",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
 ]
 
 [[package]]
 name = "clap_derive"
 version = "3.0.0-beta.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
 dependencies = [
- "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro-error 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
+ "heck",
+ "proc-macro-error",
+ "proc-macro2",
+ "quote",
+ "syn",
 ]
 
 [[package]]
 name = "envmnt"
 version = "0.8.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059"
 dependencies = [
- "fsio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "indexmap 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fsio",
+ "indexmap",
 ]
 
 [[package]]
 name = "fsio"
 version = "0.1.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3"
 
 [[package]]
 name = "hashbrown"
 version = "0.9.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
 
 [[package]]
 name = "heck"
 version = "0.3.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
 dependencies = [
- "unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-segmentation",
 ]
 
 [[package]]
 name = "hermit-abi"
 version = "0.1.16"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
 dependencies = [
- "libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc",
 ]
 
 [[package]]
 name = "indexmap"
 version = "1.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
 dependencies = [
- "autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "hashbrown 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "autocfg",
+ "hashbrown",
 ]
 
 [[package]]
 name = "lazy_static"
 version = "1.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
 
 [[package]]
 name = "libc"
 version = "0.2.77"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
 
 [[package]]
 name = "nias"
-version = "0.5.0"
+version = "0.7.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0135fd396265547ac8bd1aa38616bd1b39d9e8e9d5c9c7d8ef72fc945ba5b122"
 
 [[package]]
 name = "os_str_bytes"
 version = "2.3.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ac6fe3538f701e339953a3ebbe4f39941aababa8a3f6964635b24ab526daeac"
 
 [[package]]
 name = "proc-macro-error"
 version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
 dependencies = [
- "proc-macro-error-attr 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
- "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)",
- "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro-error-attr",
+ "proc-macro2",
+ "quote",
+ "syn",
+ "version_check",
 ]
 
 [[package]]
 name = "proc-macro-error-attr"
 version = "1.0.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
 dependencies = [
- "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
+ "quote",
+ "version_check",
 ]
 
 [[package]]
 name = "proc-macro2"
 version = "1.0.21"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
 dependencies = [
- "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid",
 ]
 
 [[package]]
 name = "quote"
 version = "1.0.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
 dependencies = [
- "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
 ]
 
 [[package]]
 name = "rusty-hook"
 version = "0.11.2"
 dependencies = [
- "ci_info 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "clap 3.0.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "nias 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ci_info",
+ "clap",
+ "nias",
+ "toml",
 ]
 
 [[package]]
 name = "serde"
 version = "1.0.116"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
 
 [[package]]
 name = "strsim"
 version = "0.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
 
 [[package]]
 name = "syn"
 version = "1.0.41"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
 dependencies = [
- "proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)",
- "quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2",
+ "quote",
+ "unicode-xid",
 ]
 
 [[package]]
 name = "termcolor"
 version = "1.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
 dependencies = [
- "winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-util",
 ]
 
 [[package]]
 name = "textwrap"
 version = "0.12.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
 dependencies = [
- "unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-width",
 ]
 
 [[package]]
 name = "toml"
 version = "0.5.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
 dependencies = [
- "serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde",
 ]
 
 [[package]]
 name = "unicode-segmentation"
 version = "1.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
 
 [[package]]
 name = "unicode-width"
 version = "0.1.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
 
 [[package]]
 name = "unicode-xid"
 version = "0.2.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
 
 [[package]]
 name = "vec_map"
 version = "0.8.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
 
 [[package]]
 name = "version_check"
 version = "0.9.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
 
 [[package]]
 name = "winapi"
 version = "0.3.9"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
 dependencies = [
- "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi-i686-pc-windows-gnu",
+ "winapi-x86_64-pc-windows-gnu",
 ]
 
 [[package]]
 name = "winapi-i686-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 
 [[package]]
 name = "winapi-util"
 version = "0.1.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
 dependencies = [
- "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
+ "winapi",
 ]
 
 [[package]]
 name = "winapi-x86_64-pc-windows-gnu"
 version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[metadata]
-"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-"checksum autocfg 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
-"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
-"checksum ci_info 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d240a3b5a8a7cb577fa8d595d8ec30828b252a58d477b4ae3309b9603204c3b5"
-"checksum clap 3.0.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
-"checksum clap_derive 3.0.0-beta.2 (registry+https://github.com/rust-lang/crates.io-index)" = "370f715b81112975b1b69db93e0b56ea4cd4e5002ac43b2da8474106a54096a1"
-"checksum envmnt 0.8.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a2d328fc287c61314c4a61af7cfdcbd7e678e39778488c7cb13ec133ce0f4059"
-"checksum fsio 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c1fd087255f739f4f1aeea69f11b72f8080e9c2e7645cd06955dad4a178a49e3"
-"checksum hashbrown 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7"
-"checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
-"checksum hermit-abi 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151"
-"checksum indexmap 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
-"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-"checksum libc 0.2.77 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
-"checksum nias 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ab250442c86f1850815b5d268639dff018c0627022bc1940eb2d642ca1ce12f0"
-"checksum os_str_bytes 2.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2ac6fe3538f701e339953a3ebbe4f39941aababa8a3f6964635b24ab526daeac"
-"checksum proc-macro-error 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
-"checksum proc-macro-error-attr 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
-"checksum proc-macro2 1.0.21 (registry+https://github.com/rust-lang/crates.io-index)" = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
-"checksum quote 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
-"checksum serde 1.0.116 (registry+https://github.com/rust-lang/crates.io-index)" = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5"
-"checksum strsim 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
-"checksum syn 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
-"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
-"checksum textwrap 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)" = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
-"checksum toml 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ffc92d160b1eef40665be3a05630d003936a3bc7da7421277846c2613e92c71a"
-"checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0"
-"checksum unicode-width 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
-"checksum unicode-xid 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
-"checksum vec_map 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-"checksum version_check 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
-"checksum winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-"checksum winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
diff --git a/Cargo.toml b/Cargo.toml
index ec06661..f5798bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -34,12 +34,12 @@ exclude = [
 ci_info = "0.11.0"
 clap = "3.0.0-beta.2"
 toml = "0.5.6"
-nias = "0.5.0"
+nias = "0.7.0"
 
 [build-dependencies]
 ci_info = "0.11.0"
 toml = "0.5.6"
-nias = "0.5.0"
+nias = "0.7.0"
 
 [badges]
 azure-devops = { project = "swellaby/opensource", pipeline = "rusty-hook.linux-pr", build="49" }
diff --git a/src/git.rs b/src/git.rs
index 87f361d..73441dd 100644
--- a/src/git.rs
+++ b/src/git.rs
@@ -1,4 +1,5 @@
 pub use hooks::NO_CONFIG_FILE_FOUND_ERROR_CODE;
+use std::collections::HashMap;
 
 mod hooks;
 
@@ -7,9 +8,19 @@ pub fn get_root_directory_path<F>(
     target_directory: Option<&str>,
 ) -> Result<Option<String>, Option<String>>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
 {
-    run_command("git rev-parse --show-toplevel", target_directory, false)
+    run_command(
+        "git rev-parse --show-toplevel",
+        target_directory,
+        false,
+        None,
+    )
 }
 
 fn get_hooks_directory<F>(
@@ -17,12 +28,18 @@ fn get_hooks_directory<F>(
     root_directory: &str,
 ) -> Result<Option<String>, Option<String>>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
 {
     run_command(
         "git rev-parse --git-path hooks",
         Some(&root_directory),
         false,
+        None,
     )
 }
 
@@ -32,7 +49,12 @@ pub fn setup_hooks<F, G>(
     root_directory_path: &str,
 ) -> Result<(), String>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
     G: Fn(&str, &str, bool) -> Result<(), String>,
 {
     let hooks_directory = match get_hooks_directory(&run_command, &root_directory_path) {
diff --git a/src/rusty_hook.rs b/src/rusty_hook.rs
index d4f3888..f584431 100644
--- a/src/rusty_hook.rs
+++ b/src/rusty_hook.rs
@@ -1,3 +1,5 @@
+use std::collections::HashMap;
+
 pub use config::NO_CONFIG_FILE_FOUND;
 pub use git::NO_CONFIG_FILE_FOUND_ERROR_CODE;
 
@@ -14,7 +16,12 @@ pub fn init_directory<F, G, H>(
     target_directory: Option<&str>,
 ) -> Result<(), String>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
     G: Fn(&str, &str, bool) -> Result<(), String>,
     H: Fn(&str) -> Result<bool, ()>,
 {
@@ -37,7 +44,12 @@ where
 
 pub fn init<F, G, H>(run_command: F, write_file: G, file_exists: H) -> Result<(), String>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
     G: Fn(&str, &str, bool) -> Result<(), String>,
     H: Fn(&str) -> Result<bool, ()>,
 {
@@ -53,7 +65,12 @@ pub fn run<F, G, H, I>(
     _args: &str,
 ) -> Result<(), Option<String>>
 where
-    F: Fn(&str, Option<&str>, bool) -> Result<Option<String>, Option<String>>,
+    F: Fn(
+        &str,
+        Option<&str>,
+        bool,
+        Option<&HashMap<String, String>>,
+    ) -> Result<Option<String>, Option<String>>,
     G: Fn(&str) -> Result<bool, ()>,
     H: Fn(&str) -> Result<String, ()>,
     I: Fn(&str, bool),
@@ -96,7 +113,7 @@ where
     );
     log(&message, log_details);
 
-    match run_command(&script, Some(&root_directory_path), log_details) {
+    match run_command(&script, Some(&root_directory_path), log_details, None) {
         Err(e) => Err(e),
         Ok(_) => Ok(()),
     }


Test patch:
diff --git a/src/git_test.rs b/src/git_test.rs
index 60df403..0091030 100644
--- a/src/git_test.rs
+++ b/src/git_test.rs
@@ -1,4 +1,6 @@
 use super::*;
+#[cfg(test)]
+use crate::rusty_hook::rusty_hook_tests::utils::build_simple_command_runner;
 
 #[cfg(test)]
 mod get_root_directory_path_tests {
@@ -8,7 +10,10 @@ mod get_root_directory_path_tests {
     fn uses_git_rev_parse_top_level_command() {
         let exp = "/usr/me/foo";
         let target_dir = "";
-        let run_command = |cmd: &str, dir: Option<&str>, stream_io: bool| {
+        let run_command = |cmd: &str,
+                           dir: Option<&str>,
+                           stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if cmd == "git rev-parse --show-toplevel" && dir == Some(target_dir) && !stream_io {
                 Ok(Some(String::from(exp)))
             } else {
@@ -22,8 +27,7 @@ mod get_root_directory_path_tests {
     #[test]
     fn returns_error_on_command_error() {
         let exp_err = "Ah!";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Err(Some(String::from(exp_err)));
+        let run_command = build_simple_command_runner(Err(Some(String::from(exp_err))));
         let act = get_root_directory_path(run_command, None);
         assert_eq!(act, Err(Some(String::from(exp_err))));
     }
@@ -37,7 +41,10 @@ mod get_hooks_directory_tests {
     fn uses_git_hooks_path_command() {
         let exp = ".git/hooks";
         let target_dir = "";
-        let run_command = |cmd: &str, dir: Option<&str>, stream_io: bool| {
+        let run_command = |cmd: &str,
+                           dir: Option<&str>,
+                           stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if cmd == "git rev-parse --git-path hooks" && dir == Some(target_dir) && !stream_io {
                 Ok(Some(String::from(exp)))
             } else {
@@ -51,8 +58,7 @@ mod get_hooks_directory_tests {
     #[test]
     fn returns_error_on_command_error() {
         let exp_err = "failed";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Err(Some(String::from(exp_err)));
+        let run_command = build_simple_command_runner(Err(Some(String::from(exp_err))));
         let act = get_hooks_directory(run_command, "");
         assert_eq!(act, Err(Some(String::from(exp_err))));
     }
@@ -65,7 +71,7 @@ mod setup_hooks_tests {
     #[test]
     fn errors_when_hooks_directory_unknown() {
         let exp_err = "Failure determining git hooks directory";
-        let run_command = |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Err(None);
+        let run_command = build_simple_command_runner(Err(None));
         let write_file = |_path: &str, _contents: &str, _x: bool| Ok(());
         let result = setup_hooks(run_command, write_file, "");
         assert_eq!(result, Err(String::from(exp_err)));
@@ -73,9 +79,8 @@ mod setup_hooks_tests {
 
     #[test]
     fn errors_when_hook_write_fails() {
-        let run_command = |_cmd: &str, _dir: Option<&str>, _stream_io: bool| {
-            Ok(Some(String::from("/usr/repos/foo/.git/hooks")))
-        };
+        let run_command =
+            build_simple_command_runner(Ok(Some(String::from("/usr/repos/foo/.git/hooks"))));
         let write_file = |_path: &str, _contents: &str, _x: bool| Err(String::from(""));
         let result = setup_hooks(run_command, write_file, "");
         assert_eq!(result, Err(String::from(hooks::HOOK_CREATION_ERROR)));
@@ -85,7 +90,7 @@ mod setup_hooks_tests {
     fn creates_all_hooks() {
         let root_dir = "/usr/repos/foo";
         let git_hooks = ".git/hooks";
-        let run_command = |_c: &str, _d: Option<&str>, _s: bool| Ok(Some(String::from(git_hooks)));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(git_hooks))));
         let write_file = |_p: &str, _c: &str, _x: bool| Ok(());
         let result = setup_hooks(run_command, write_file, root_dir);
         assert_eq!(result, Ok(()));
diff --git a/src/rusty_hook_test.rs b/src/rusty_hook_test.rs
index 3dc49c0..ce3bae4 100644
--- a/src/rusty_hook_test.rs
+++ b/src/rusty_hook_test.rs
@@ -1,14 +1,38 @@
 use super::*;
+use std::collections::HashMap;
+
+#[cfg(test)]
+pub(crate) mod utils {
+    use std::collections::HashMap;
+
+    #[allow(clippy::type_complexity)]
+    pub(crate) fn build_simple_command_runner(
+        outcome: Result<Option<String>, Option<String>>,
+    ) -> Box<
+        dyn Fn(
+            &str,
+            Option<&str>,
+            bool,
+            Option<&HashMap<String, String>>,
+        ) -> Result<Option<String>, Option<String>>,
+    > {
+        Box::new(
+            move |_: &str, _: Option<&str>, _: bool, _: Option<&HashMap<String, String>>| {
+                outcome.to_owned()
+            },
+        )
+    }
+}
 
 #[cfg(test)]
 mod init_directory_tests {
+    use super::utils::build_simple_command_runner;
     use super::*;
 
     #[test]
     fn returns_error_when_root_directory_detect_fails() {
         let exp_err = "Failure determining git repo root directory";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Err(Some(String::from(exp_err)));
+        let run_command = build_simple_command_runner(Err(Some(String::from(exp_err))));
         let write_file = |_file_path: &str, _contents: &str, _x: bool| {
             panic!("Should not get here");
         };
@@ -19,8 +43,7 @@ mod init_directory_tests {
 
     #[test]
     fn should_return_error_when_hook_creation_fails() {
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let write_file = |_file_path: &str, _contents: &str, _x: bool| Err(String::from(""));
         let file_exists = |_path: &str| panic!("Should not get here");
         let result = init(run_command, write_file, file_exists);
@@ -29,8 +52,7 @@ mod init_directory_tests {
 
     #[test]
     fn should_return_error_when_config_creation_fails() {
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let write_file = |_file_path: &str, _contents: &str, _x: bool| Ok(());
         let file_exists = |_path: &str| Err(());
         let result = init(run_command, write_file, file_exists);
@@ -39,8 +61,7 @@ mod init_directory_tests {
 
     #[test]
     fn should_return_ok_on_success() {
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let write_file = |_file_path: &str, _contents: &str, _x: bool| Ok(());
         let file_exists = |_path: &str| Ok(false);
         let result = init(run_command, write_file, file_exists);
@@ -53,7 +74,10 @@ mod init_tests {
 
     #[test]
     fn invokes_init_directory_with_cwd() {
-        let run_command = |_cmd: &str, dir: Option<&str>, _stream_io: bool| {
+        let run_command = |_cmd: &str,
+                           dir: Option<&str>,
+                           _stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if let Some(target_dir) = dir {
                 if target_dir != "." {
                     return Err(None);
@@ -72,13 +96,13 @@ mod init_tests {
 
 #[cfg(test)]
 mod run_tests {
+    use super::utils::build_simple_command_runner;
     use super::*;
 
     #[test]
     fn returns_error_when_root_directory_detect_fails() {
         let exp_err = "Failure determining git repo root directory";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Err(Some(String::from(exp_err)));
+        let run_command = build_simple_command_runner(Err(Some(String::from(exp_err))));
         let read_file = |_file_path: &str| panic!("");
         let file_exists = |_path: &str| panic!("");
         let log = |_path: &str, _should_log: bool| panic!("");
@@ -89,8 +113,7 @@ mod run_tests {
     #[test]
     fn returns_error_when_config_file_missing() {
         let exp_err = config::NO_CONFIG_FILE_FOUND;
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let read_file = |_file_path: &str| Err(());
         let file_exists = |_path: &str| Ok(false);
         let log = |_path: &str, _should_log: bool| panic!("");
@@ -101,8 +124,7 @@ mod run_tests {
     #[test]
     fn returns_error_when_config_contents_unloadable() {
         let exp_err = "Failed to parse config file";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let read_file = |_file_path: &str| Err(());
         let file_exists = |_path: &str| Ok(true);
         let log = |_path: &str, _should_log: bool| panic!("");
@@ -115,8 +137,7 @@ mod run_tests {
         let contents = "[hooks]
             pre-commit = 'cargo test'
         ";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let read_file = |_file_path: &str| Ok(String::from(contents));
         let file_exists = |_path: &str| Ok(true);
         let log = |_path: &str, _should_log: bool| panic!("");
@@ -128,8 +149,7 @@ mod run_tests {
     fn returns_error_on_invalid_config() {
         let exp_err = "Invalid rusty-hook config file";
         let contents = "abc";
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let read_file = |_file_path: &str| Ok(String::from(contents));
         let file_exists = |_path: &str| Ok(true);
         let log = |_path: &str, _should_log: bool| panic!("");
@@ -145,7 +165,10 @@ mod run_tests {
             [logging]
             verbose = false
         "#;
-        let run_command = |cmd: &str, _dir: Option<&str>, stream_io: bool| {
+        let run_command = |cmd: &str,
+                           _dir: Option<&str>,
+                           stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if cmd == "cargo test" && stream_io {
                 panic!("")
             }
@@ -170,7 +193,10 @@ mod run_tests {
             [logging]
             verbose = true
         "#;
-        let run_command = |cmd: &str, _dir: Option<&str>, stream_io: bool| {
+        let run_command = |cmd: &str,
+                           _dir: Option<&str>,
+                           stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if cmd == "cargo test" && !stream_io {
                 panic!("")
             }
@@ -195,8 +221,7 @@ mod run_tests {
             [logging]
             verbose = false
         "#;
-        let run_command =
-            |_cmd: &str, _dir: Option<&str>, _stream_io: bool| Ok(Some(String::from("")));
+        let run_command = build_simple_command_runner(Ok(Some(String::from(""))));
         let read_file = |_file_path: &str| Ok(String::from(contents));
         let file_exists = |_path: &str| Ok(true);
         let log = |_path: &str, _should_log: bool| ();
@@ -213,7 +238,10 @@ mod run_tests {
             [logging]
             verbose = false
         "#;
-        let run_command = |cmd: &str, _dir: Option<&str>, _stream_io: bool| {
+        let run_command = |cmd: &str,
+                           _dir: Option<&str>,
+                           _stream_io: bool,
+                           _env: Option<&HashMap<String, String>>| {
             if cmd == "cargo test" {
                 return Err(Some(String::from(exp_err)));
             }