diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 174d772..4f47ac0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,6 @@ name: CI -on: - [push, pull_request] +on: [pull_request, push] env: CARGO_TERM_COLOR: always @@ -18,13 +17,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/clippy-check@v1 - with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features - name: Run cargo fmt run: cargo fmt --all -- --check - name: Run tests - run: cargo test --verbose \ No newline at end of file + run: cargo test --verbose diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 0000000..9b3a154 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,18 @@ +name: Clippy + +on: pull_request + +env: + CARGO_TERM_COLOR: always + +jobs: + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - run: rustup component add clippy + - uses: Swatinem/rust-cache@v2 + - uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + args: --all-features \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 6cc7020..0d987cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,18 +4,18 @@ version = 3 [[package]] name = "aho-corasick" -version = "0.7.18" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -27,15 +27,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -46,17 +46,17 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" dependencies = [ - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -92,13 +92,20 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bstr" -version = "0.2.17" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", + "serde", ] [[package]] @@ -109,20 +116,19 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "4.4.1" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.4.1" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", @@ -132,21 +138,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.0" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.28", + "syn", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -156,7 +162,7 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "commit" -version = "0.6.0" +version = "0.7.0" dependencies = [ "anyhow", "assert_fs", @@ -165,16 +171,7 @@ dependencies = [ "inquire", "serde", "serde_json", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" -dependencies = [ - "cfg-if", - "lazy_static", + "serial_test", ] [[package]] @@ -183,7 +180,7 @@ version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossterm_winapi", "libc", "mio", @@ -195,13 +192,26 @@ dependencies = [ [[package]] name = "crossterm_winapi" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ae1b35a484aa10e07fe0638d02301c5ad24de82d310ccbd2f3693da5f09bf1c" +checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" dependencies = [ "winapi", ] +[[package]] +name = "dashmap" +version = "5.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" +dependencies = [ + "cfg-if", + "hashbrown", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "difflib" version = "0.4.0" @@ -226,7 +236,7 @@ dependencies = [ "libc", "option-ext", "redox_users", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -237,15 +247,31 @@ checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "23d2f3407d9a573d666de4b5bdf10569d73ca9478087346697dcbae6244bfbcd" [[package]] name = "either" -version = "1.6.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fnv" @@ -253,22 +279,99 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + [[package]] name = "getrandom" -version = "0.2.3" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "globset" -version = "0.4.8" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d" dependencies = [ "aho-corasick", "bstr", @@ -283,24 +386,29 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc" dependencies = [ - "bitflags", + "bitflags 1.3.2", "ignore", "walkdir", ] +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" + [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "ignore" -version = "0.4.18" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" +checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492" dependencies = [ - "crossbeam-utils", "globset", "lazy_static", "log", @@ -318,7 +426,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33e7c1ddeb15c9abcbfef6029d8e29f69b52b6d6c891031b88ed91b5065803b" dependencies = [ - "bitflags", + "bitflags 1.3.2", "crossterm", "dyn-clone", "lazy_static", @@ -330,18 +438,18 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.1" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "lazy_static" @@ -351,15 +459,21 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -367,42 +481,42 @@ dependencies = [ [[package]] name = "log" -version = "0.4.14" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" -dependencies = [ - "cfg-if", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.4.1" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "mio" -version = "0.8.5" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "wasi", + "windows-sys", ] [[package]] name = "newline-converter" -version = "0.2.0" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f81c2b19eebbc4249b3ca6aff70ae05bf18d6a99b7cc63cf0248774e640565" +checksum = "1f71d09d5c87634207f894c6b31b6a2b2c64ea3bdcf71bd5599fdbbe1600c00f" +dependencies = [ + "unicode-segmentation", +] [[package]] name = "once_cell" -version = "1.16.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "option-ext" @@ -422,28 +536,34 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.4.1", "smallvec", - "windows-sys 0.42.0", + "windows-targets", ] [[package]] -name = "ppv-lite86" -version = "0.2.15" +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pin-utils" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "predicates" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09963355b9f467184c04017ced4a2ba2d75cbcb4e7462690d388233253d4b1a9" +checksum = "6dfc28575c2e3f19cb3c73b93af36460ae898d426eba6fc15b9bd2a5220758a0" dependencies = [ "anstyle", "difflib", @@ -459,9 +579,9 @@ checksum = "b794032607612e7abeb4db69adb4e33590fa6cf1149e95fd7cb00e634b92f174" [[package]] name = "predicates-tree" -version = "1.0.4" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "338c7be2905b732ae3984a2f40032b5e94fd8f52505b186c7d4d68d193445df7" +checksum = "368ba315fb8c5052ab692e68a0eefec6ec57b23a36959c14496f0b0df2c0cecf" dependencies = [ "predicates-core", "termtree", @@ -469,86 +589,77 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] [[package]] -name = "rand" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" +name = "redox_syscall" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "ppv-lite86", - "rand_core", + "bitflags 1.3.2", ] [[package]] -name = "rand_core" -version = "0.6.3" +name = "redox_syscall" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "getrandom", + "bitflags 1.3.2", ] [[package]] -name = "rand_hc" -version = "0.3.1" +name = "redox_syscall" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ - "rand_core", + "bitflags 1.3.2", ] [[package]] -name = "redox_syscall" -version = "0.2.10" +name = "redox_users" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ - "bitflags", + "getrandom", + "redox_syscall 0.2.16", + "thiserror", ] [[package]] -name = "redox_users" -version = "0.4.0" +name = "regex" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ - "getrandom", - "redox_syscall", + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", ] [[package]] -name = "regex" -version = "1.5.4" +name = "regex-automata" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -557,24 +668,28 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.25" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] -name = "remove_dir_all" -version = "0.5.3" +name = "rustix" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ - "winapi", + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", ] [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -587,46 +702,71 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "serial_test" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e56dd856803e253c8f298af3f4d7eb0ae5e23a737252cd90bb4f3b435033b2d" +dependencies = [ + "dashmap", + "futures", + "lazy_static", + "log", + "parking_lot", + "serial_test_derive", +] + +[[package]] +name = "serial_test_derive" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91d129178576168c589c9ec973feedf7d3126c01ac2bf08795109aa35b69fb8f" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "signal-hook" -version = "0.3.14" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a253b5e89e2698464fc26b545c9edceb338e18a89effeeecfea192c3025be29d" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" dependencies = [ "libc", "signal-hook-registry", @@ -645,18 +785,27 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + [[package]] name = "smallvec" -version = "1.7.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "strsim" @@ -666,20 +815,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.28" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -688,70 +826,70 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.2.0" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi", + "fastrand", + "redox_syscall 0.3.5", + "rustix", + "windows-sys", ] [[package]] name = "termtree" -version = "0.2.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13a4ec180a2de59b57434704ccfad967f789b12737738798fa08798cd5824c16" +checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.30" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.30" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 1.0.107", + "syn", ] [[package]] name = "thread_local" -version = "1.1.3" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" dependencies = [ + "cfg-if", "once_cell", ] [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" -version = "1.8.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" [[package]] name = "unicode-width" -version = "0.1.9" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "utf8parse" @@ -761,21 +899,14 @@ checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" [[package]] name = "walkdir" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", - "winapi", "winapi-util", ] -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -800,9 +931,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -813,21 +944,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.1", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm 0.42.1", - "windows_x86_64_msvc 0.42.1", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -839,99 +955,57 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/Cargo.toml b/Cargo.toml index 849b24c..b3ebd96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "commit" -version = "0.6.0" +version = "0.7.0" edition = "2021" homepage = "https://github.com/alt-art/commit" repository = "https://github.com/alt-art/commit" @@ -15,14 +15,15 @@ license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] inquire = "0.6.2" -serde = { version = "1.0.188", features = ["derive"] } -serde_json = "1.0.105" -clap = { version = "4.4.1", features = ["derive"] } +serde = { version = "1.0.192", features = ["derive"] } +serde_json = "1.0.108" +clap = { version = "4.4.8", features = ["derive"] } dirs = "5.0.1" anyhow = "1.0.75" [dev-dependencies] assert_fs = "1.0.13" +serial_test = "2.0.0" [package.metadata.deb] name = "commit" diff --git a/INSTALL.md b/INSTALL.md index 2a19d1d..c2d7986 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -21,8 +21,8 @@ yay -S commits > Verify what is the latest release [here](https://github.com/alt-art/commit/releases) ```bash -wget https://github.com/alt-art/commit/releases/download/0.6.0/commit_0.6.0_amd64.deb -apt install ./commit_0.6.0_amd64.deb +wget https://github.com/alt-art/commit/releases/download/0.7.0/commit_0.7.0_amd64.deb +apt install ./commit_0.7.0_amd64.deb ``` ### Fedora @@ -30,8 +30,8 @@ apt install ./commit_0.6.0_amd64.deb > Verify what is the latest release [here](https://github.com/alt-art/commit/releases) ```bash -wget https://github.com/alt-art/commit/releases/download/0.6.0/commit_0.6.0_x86_64.rpm -dnf install ./commit_0.6.0_x86_64.rpm +wget https://github.com/alt-art/commit/releases/download/0.7.0/commit_0.7.0_x86_64.rpm +dnf install ./commit_0.7.0_x86_64.rpm ``` ### Install from source @@ -39,7 +39,7 @@ dnf install ./commit_0.6.0_x86_64.rpm Requires rust and cargo ```bash -git clone https://github/alt-art/commit +git clone https://github.com/alt-art/commit.git cd commit cargo build --release ``` @@ -56,11 +56,11 @@ cp target/release/commit /usr/local/bin ```shell mkdir "C:\Program Files\commits" -copy commit.exe "C:\Program Files\commits" +copy commit.exe "C:\Program Files\commit" ``` #### Add program to PATH on windows ```shell -setx /M PATH "%PATH%;C:\Program Files\commits" +setx /M PATH "%PATH%;C:\Program Files\commit" ``` diff --git a/README.md b/README.md index 0d08e04..27f9c16 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ See [Installation guide](INSTALL.md) for installation. This command-line interface makes it possible to make patterned (conventional) commit messages to organize your repository. -This project is a clone of [cz-cli](https://github.com/commitizen/cz-cli) with some minor changes. +This project is based on [cz-cli](https://github.com/commitizen/cz-cli) but do everything best than the original. I made this project for my own use, because I don't want to mess with the original cz-cli. diff --git a/commit-default.json b/commit-default.json deleted file mode 100644 index c1fcb1e..0000000 --- a/commit-default.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "config": { - "subject_separator": ": ", - "scope_prefix": "(", - "scope_suffix": ")" - }, - "commit_types": [ - { "name": "feat", "description": "A new feature" }, - { "name": "fix", "description": "A bug fix" }, - { "name": "docs", "description": "Documentation only changes" }, - { - "name": "style", - "description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)" - }, - { - "name": "refactor", - "description": "A code change that neither fixes a bug nor adds a feature" - }, - { - "name": "perf", - "description": "A code change that improves performance" - }, - { - "name": "test", - "description": "Adding missing tests or correcting existing tests" - }, - { - "name": "chore", - "description": "Other changes that don't modify src or test files" - } - ], - "commit_scopes": [ - { "name": "custom", "description": "Custom scope" }, - { "name": "none", "description": "No scope" } - ], - "msg": { - "commit_type": "What type of commit you will made?", - "commit_scope": "What scope of commit you will made? (Optional)", - "commit_description": "Write a SHORT, IMPERATIVE tense description of the change:", - "commit_body": "Provide a LONGER description of the change (Optional):", - "commit_footer": "List any ISSUES CLOSED by this change E.g.: #31, #34 (Optional):" - } -} diff --git a/commit.json b/commit.json index ddb59ca..d2ad227 100644 --- a/commit.json +++ b/commit.json @@ -1,44 +1,5 @@ { "config": { - "subject_separator": ": ", - "scope_prefix": "(", - "scope_suffix": ")", "pre_commit": "./pre-commit.sh" - }, - "commit_types": [ - { "name": "feat", "description": "A new feature" }, - { "name": "fix", "description": "A bug fix" }, - { "name": "docs", "description": "Documentation only changes" }, - { - "name": "style", - "description": "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)" - }, - { - "name": "refactor", - "description": "A code change that neither fixes a bug nor adds a feature" - }, - { - "name": "perf", - "description": "A code change that improves performance" - }, - { - "name": "test", - "description": "Adding missing tests or correcting existing tests" - }, - { - "name": "chore", - "description": "Other changes that don't modify src or test files" - } - ], - "commit_scopes": [ - { "name": "custom", "description": "Custom scope" }, - { "name": "none", "description": "No scope" } - ], - "msg": { - "commit_type": "What type of commit you will made?", - "commit_scope": "What scope of commit you will made? (Optional)", - "commit_description": "Write a SHORT, IMPERATIVE tense description of the change:", - "commit_body": "Provide a LONGER description of the change (Optional):", - "commit_footer": "List any ISSUES CLOSED by this change E.g.: #31, #34 (Optional):" } } diff --git a/src/commit.rs b/src/commit.rs index d7decb4..b7e0824 100644 --- a/src/commit.rs +++ b/src/commit.rs @@ -87,3 +87,15 @@ pub fn pre_commit_check(pre_commit_command: Option, message: &str) -> Re } Ok(()) } + +pub fn git_add_all_modified() -> Result<()> { + let output = git_exec(&["add", "-u"])?; + std::io::stdout().write_all(&output.stdout)?; + std::io::stderr().write_all(&output.stderr)?; + + if !output.status.success() { + return Err(anyhow!("Could not add files to staged area")); + } + + Ok(()) +} diff --git a/src/commit_message/message_build/mod.rs b/src/commit_message/message_build/mod.rs index ef4b8e4..e544e7d 100644 --- a/src/commit_message/message_build/mod.rs +++ b/src/commit_message/message_build/mod.rs @@ -1,7 +1,7 @@ #[cfg(test)] mod tests; -use crate::config::Config; +use crate::commit_pattern::Config; pub struct MessageBuilder { config: Config, diff --git a/src/commit_message/message_build/tests.rs b/src/commit_message/message_build/tests.rs index df731b9..18fdd97 100644 --- a/src/commit_message/message_build/tests.rs +++ b/src/commit_message/message_build/tests.rs @@ -1,5 +1,5 @@ use crate::commit_message::message_build::MessageBuilder; -use crate::config::Config; +use crate::commit_pattern::Config; fn message_with_config(config: Config) -> String { let mut builder = MessageBuilder::new(config); diff --git a/src/commit_message/mod.rs b/src/commit_message/mod.rs index 535ad84..fc082b5 100644 --- a/src/commit_message/mod.rs +++ b/src/commit_message/mod.rs @@ -2,11 +2,11 @@ mod message_build; mod prompt; use anyhow::{anyhow, Result}; - -use crate::config::CommitPattern; use message_build::MessageBuilder; use prompt::Prompt; +use crate::commit_pattern::CommitPattern; + pub fn make_message_commit(pattern: CommitPattern) -> Result { let mut message_inquirer = MessageInquirer::new(pattern.clone()); let skip_commit = pattern.skip_commit; diff --git a/src/commit_message/prompt.rs b/src/commit_message/prompt.rs index 72a2b60..3607ee9 100644 --- a/src/commit_message/prompt.rs +++ b/src/commit_message/prompt.rs @@ -1,4 +1,4 @@ -use crate::config::Type; +use crate::commit_pattern::Type; use inquire::{ required, diff --git a/src/commit_pattern/config.rs b/src/commit_pattern/config.rs new file mode 100644 index 0000000..6ec2fa0 --- /dev/null +++ b/src/commit_pattern/config.rs @@ -0,0 +1,39 @@ +use serde::Deserialize; + +#[derive(Deserialize, Clone)] +pub struct Config { + pub type_prefix: Option, + pub type_suffix: Option, + #[serde(default = "Config::subject_separator")] + pub subject_separator: String, + #[serde(default = "Config::scope_prefix")] + pub scope_prefix: String, + #[serde(default = "Config::scope_suffix")] + pub scope_suffix: String, + pub pre_commit: Option, +} + +impl Config { + fn subject_separator() -> String { + ": ".to_owned() + } + fn scope_prefix() -> String { + "(".to_owned() + } + fn scope_suffix() -> String { + ")".to_owned() + } +} + +impl Default for Config { + fn default() -> Self { + Self { + type_prefix: None, + type_suffix: None, + subject_separator: Self::subject_separator(), + scope_prefix: Self::scope_prefix(), + scope_suffix: Self::scope_suffix(), + pre_commit: None, + } + } +} diff --git a/src/commit_pattern/messages.rs b/src/commit_pattern/messages.rs new file mode 100644 index 0000000..970572d --- /dev/null +++ b/src/commit_pattern/messages.rs @@ -0,0 +1,46 @@ +use serde::Deserialize; + +#[derive(Deserialize, Clone)] +pub struct Messages { + #[serde(default = "Messages::commit_type")] + pub commit_type: String, + #[serde(default = "Messages::commit_scope")] + pub commit_scope: String, + #[serde(default = "Messages::commit_description")] + pub commit_description: String, + #[serde(default = "Messages::commit_body")] + pub commit_body: String, + #[serde(default = "Messages::commit_footer")] + pub commit_footer: String, +} + +impl Messages { + fn commit_type() -> String { + "What type of commit you will made?".to_owned() + } + fn commit_scope() -> String { + "What scope of commit you will made? (Optional)".to_owned() + } + fn commit_description() -> String { + "Write a SHORT, IMPERATIVE tense description of the change:".to_owned() + } + fn commit_body() -> String { + "Provide a LONGER description of the change (Optional):".to_owned() + } + + fn commit_footer() -> String { + "List any ISSUES CLOSED by this change E.g.: #31, #34 (Optional):".to_owned() + } +} + +impl Default for Messages { + fn default() -> Self { + Self { + commit_type: Self::commit_type(), + commit_scope: Self::commit_scope(), + commit_description: Self::commit_description(), + commit_body: Self::commit_body(), + commit_footer: Self::commit_footer(), + } + } +} diff --git a/src/commit_pattern/mod.rs b/src/commit_pattern/mod.rs new file mode 100644 index 0000000..8541a6e --- /dev/null +++ b/src/commit_pattern/mod.rs @@ -0,0 +1,97 @@ +mod config; +mod messages; + +use serde::Deserialize; +use std::fmt::{Display, Formatter, Result as FmtResult}; + +pub use config::Config; +use messages::Messages; + +impl Display for Type { + fn fmt(&self, formatter: &mut Formatter) -> FmtResult { + write!(formatter, "{} - {}", self.name, self.description) + } +} + +#[derive(Clone, Deserialize)] +pub struct Type { + pub name: String, + pub description: String, +} + +#[derive(Deserialize, Clone)] +pub struct CommitPattern { + #[serde(default)] + pub config: Config, + #[serde(default = "CommitPattern::commit_types")] + pub commit_types: Vec, + #[serde(default = "CommitPattern::commit_scopes")] + pub commit_scopes: Vec, + #[serde(default)] + pub skip_commit: Vec, + #[serde(default)] + pub msg: Messages, +} + +impl CommitPattern { + fn commit_types() -> Vec { + vec![ + Type { + name: "feat".to_owned(), + description: "A new feature".to_owned(), + }, + Type { + name: "fix".to_owned(), + description: "A bug fix".to_owned(), + }, + Type { + name: "docs".to_owned(), + description: "Documentation only changes".to_owned(), + }, + Type { + name: "style".to_owned(), + description: "Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)".to_owned(), + }, + Type { + name: "refactor".to_owned(), + description: "A code change that neither fixes a bug nor adds a feature".to_owned(), + }, + Type { + name: "perf".to_owned(), + description: "A code change that improves performance".to_owned(), + }, + Type { + name: "test".to_owned(), + description: "Adding missing tests or correcting existing tests".to_owned(), + }, + Type { + name: "chore".to_owned(), + description: "Other changes that don't modify src or test files".to_owned(), + }, + ] + } + fn commit_scopes() -> Vec { + vec![ + Type { + name: "custom".to_owned(), + description: "Custom scope".to_owned(), + }, + Type { + name: "none".to_owned(), + description: "No scope".to_owned(), + }, + ] + } +} + +impl Default for CommitPattern { + fn default() -> Self { + Self { + config: Config::default(), + commit_types: Self::commit_types(), + commit_scopes: Self::commit_scopes(), + skip_commit: vec![], + msg: Messages::default(), + } + } +} diff --git a/src/config/mod.rs b/src/config/mod.rs index 07ae18d..24be087 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -2,59 +2,10 @@ mod tests; use anyhow::{anyhow, Context, Result}; -use serde::Deserialize; -use std::fmt::{Display, Formatter, Result as FmtResult}; -use std::fs; -use std::path::Path; +use std::fs::File; use std::path::PathBuf; -use crate::DEFAULT_CONFIG_FILE; - -#[derive(Deserialize, Clone)] -pub struct Config { - pub type_prefix: Option, - pub type_suffix: Option, - pub subject_separator: String, - pub scope_prefix: String, - pub scope_suffix: String, - pub pre_commit: Option, -} - -impl Display for Type { - fn fmt(&self, formatter: &mut Formatter) -> FmtResult { - write!(formatter, "{} - {}", self.name, self.description) - } -} - -#[derive(Clone, Deserialize)] -pub struct Type { - pub name: String, - pub description: String, -} - -#[derive(Deserialize, Clone)] -pub struct Messages { - pub commit_type: String, - pub commit_scope: String, - pub commit_description: String, - pub commit_body: String, - pub commit_footer: String, -} - -#[derive(Deserialize, Clone)] -pub struct CommitPattern { - pub config: Config, - pub commit_types: Vec, - pub commit_scopes: Vec, - #[serde(default)] - pub skip_commit: Vec, - pub msg: Messages, -} - -fn get_config_path_content(config_path: impl AsRef) -> Result { - let content = fs::read_to_string(config_path)?; - Ok(content) -} +use crate::commit_pattern::CommitPattern; fn select_custom_config_path(config: Option) -> Result { match config { @@ -78,23 +29,44 @@ fn select_custom_config_path(config: Option) -> Result { } } -fn get_config_path() -> Result { +fn search_config_file_on_parents() -> Result> { let current_dir = std::env::current_dir()?; - let current_file = current_dir.join("commit.json"); - if current_file.is_file() { - Ok(current_file) - } else { - let config_file = dirs::config_dir() - .ok_or_else(|| anyhow!("Could not find config directory"))? - .join("commit/commit.json"); - Ok(config_file) + let mut current_dir = current_dir.as_path(); + loop { + let config_file = current_dir.join("commit.json"); + if config_file.is_file() { + return Ok(Some(config_file)); + } + if let Some(parent) = current_dir.parent() { + current_dir = parent; + } else { + break; + } } + Ok(None) +} + +fn get_config_path() -> Result { + Ok(search_config_file_on_parents()?.unwrap_or_else(|| { + dirs::config_dir() + .expect("Could not find config directory") + .join("commit/commit.json") + })) } pub fn get_pattern(config_path: Option) -> Result { - let default_pattern_str = DEFAULT_CONFIG_FILE; let selected_config_path = select_custom_config_path(config_path)?; - let pattern_str = get_config_path_content(selected_config_path) - .unwrap_or_else(|_| default_pattern_str.to_owned()); - serde_json::from_str(&pattern_str).context("Failed to parse commit pattern from file") + if selected_config_path.exists() { + let file = File::open(&selected_config_path).context(format!( + "Could not open config file: {}", + selected_config_path.display() + ))?; + let reader = std::io::BufReader::new(file); + Ok(serde_json::from_reader(reader).context(format!( + "Could not parse config file: {}", + selected_config_path.display() + ))?) + } else { + Ok(CommitPattern::default()) + } } diff --git a/src/config/tests.rs b/src/config/tests.rs index 1787a10..f953ba9 100644 --- a/src/config/tests.rs +++ b/src/config/tests.rs @@ -1,9 +1,11 @@ -use std::env::set_current_dir; +use std::{env::set_current_dir, fs::remove_file}; use super::*; use assert_fs::prelude::*; +use serial_test::serial; #[test] +#[serial] fn select_custom_config_path_test() -> Result<()> { let temp_dir = assert_fs::TempDir::new()?; let config_file = temp_dir.child("config.json"); @@ -27,9 +29,18 @@ fn select_custom_config_path_test() -> Result<()> { } #[test] +#[serial] fn get_config_path_test() -> Result<()> { let temp_dir = assert_fs::TempDir::new()?; - set_current_dir(temp_dir.path())?; + temp_dir.child("commit.json").touch()?; + temp_dir.child("some/sub/dir").create_dir_all()?; + set_current_dir(temp_dir.path().join("some/sub/dir"))?; + let config_path = get_config_path()?; + assert_eq!( + config_path.to_str(), + temp_dir.path().join("commit.json").to_str() + ); + remove_file(temp_dir.path().join("commit.json"))?; let config_file = dirs::config_dir() .ok_or_else(|| anyhow!("Could not find config directory"))? .join("commit/commit.json"); @@ -39,22 +50,7 @@ fn get_config_path_test() -> Result<()> { } #[test] -fn get_config_path_content_test() -> Result<()> { - let temp_dir = assert_fs::TempDir::new()?; - let config_file = temp_dir.child("config.json"); - config_file.touch()?; - let config_path = config_file.path(); - let content = get_config_path_content(config_path)?; - assert_eq!(content, ""); - - let expected = include_str!("../../commit-default.json"); - config_file.write_str(expected)?; - let content = get_config_path_content(config_path)?; - assert_eq!(content, expected); - Ok(()) -} - -#[test] +#[serial] fn get_pattern_test() -> Result<()> { let temp_dir = assert_fs::TempDir::new()?; set_current_dir(temp_dir.path())?; diff --git a/src/main.rs b/src/main.rs index fe33743..73501ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,52 +5,53 @@ clippy::cargo, clippy::str_to_string )] -#![allow(clippy::module_name_repetitions, clippy::multiple_crate_versions)] +#![allow( + clippy::module_name_repetitions, + clippy::multiple_crate_versions, + clippy::struct_excessive_bools +)] mod commit; mod commit_message; +mod commit_pattern; mod config; use anyhow::Result; use clap::Parser; -use std::io::Write; use std::path::PathBuf; use commit::{ - check_staged_files, commit, pre_commit_check, read_cached_commit, write_cached_commit, + check_staged_files, commit, git_add_all_modified, pre_commit_check, read_cached_commit, + write_cached_commit, }; use commit_message::make_message_commit; -const DEFAULT_CONFIG_FILE: &str = include_str!("../commit-default.json"); - #[derive(Parser, Debug)] #[command(about, author, version)] struct Args { /// Custom configuration file path #[arg(short, long)] config: Option, - /// Init custom configuration file - #[arg(long)] - init: bool, /// Use as hook #[arg(long)] hook: bool, /// Retry commit with the same message as the last one #[arg(short, long)] retry: bool, + /// Add all modified files into staging + #[arg(short, long)] + all: bool, } fn main() -> Result<()> { let args = Args::parse(); - check_staged_files()?; - - if args.init { - let mut file = std::fs::File::create("commit.json")?; - file.write_all(DEFAULT_CONFIG_FILE.as_bytes())?; - return Ok(()); + if args.all { + git_add_all_modified()?; } + check_staged_files()?; + let pattern = config::get_pattern(args.config)?; if args.retry {