Compare commits
158 Commits
4418427caf
...
renovate/a
Author | SHA1 | Date | |
---|---|---|---|
fefba801ec | |||
322bd4c9e7 | |||
63462ce252 | |||
44e720ff50 | |||
4381b9c160 | |||
ea74c41d74 | |||
ec34a47faf | |||
85d80db364 | |||
4f44862160 | |||
25d43765d9 | |||
88680da7d5 | |||
2a46b7b170 | |||
f9513fe051 | |||
09cfa5b88f | |||
88b602a124 | |||
674266664d | |||
39dc4ae15c | |||
55a5a9a1e1 | |||
92a0e3b1b3 | |||
b167b3ebfa | |||
b78631d6ac | |||
00a249978e | |||
a86a4197f7 | |||
0397b64e28 | |||
77901c6ac9 | |||
a1eadd67e1 | |||
d5271807f7 | |||
947e05e573 | |||
a720dedcf5 | |||
446c957a97 | |||
fa7041187f | |||
f5ff75bfbe | |||
a34118b5e8 | |||
6e4fa67778 | |||
0a8d1105e5 | |||
e370e4d282 | |||
aeab954230 | |||
253b4d5c38 | |||
532506ca0a | |||
cd5b8645ff | |||
acb6673978 | |||
960682a45b | |||
819bcc68c6 | |||
79903524aa | |||
6771a8a6b7 | |||
9f7a322e51 | |||
d728b2f4d7 | |||
961b039779 | |||
b97f261cfd | |||
2085408670 | |||
56490da09b | |||
a2103271b3 | |||
8003a98d83 | |||
de481ddb28 | |||
cb409fe153 | |||
382612bdb0 | |||
bda5a4e1c3 | |||
767b48bbe4 | |||
5b34eaf6ed | |||
170438211b | |||
79fc45b5dd | |||
c7ca0932eb | |||
1f215596b3 | |||
ea96ddfe56 | |||
5c226e9dd8 | |||
7576ade7cb | |||
4420465f41 | |||
8dc0d1fc25 | |||
8067c265e5 | |||
da1e47cbe3 | |||
06181043db | |||
07899fcb44 | |||
bbe415b803 | |||
99fa1900d4 | |||
8d5a524d7d | |||
84302de6ba | |||
c6561a12cc | |||
466c16bc28 | |||
b60e464942 | |||
6db3576f63 | |||
01b5ea1bfd | |||
5a4a94591a | |||
286508a432 | |||
5fc473040e | |||
9687c67cf6 | |||
7f86f27930 | |||
de13281e81 | |||
ad16745b72 | |||
331e5a6825 | |||
c68d6400b7 | |||
69d4d9f5f8 | |||
f7ea903d86 | |||
1827d57f9f | |||
b5b6278d51 | |||
f61b5c0020 | |||
cbc4a72efb | |||
a1db5d795b | |||
de59bdb931 | |||
c32e19ae10 | |||
c16b9e8b47 | |||
a4c40c10cc | |||
078e5a6f3d | |||
f61efa29bd | |||
7eea96cd28 | |||
431cdc876c | |||
63c4bd036e | |||
0168288fbb | |||
40321a000d | |||
796534862e | |||
e722772dfa | |||
d4027ad5fe | |||
fbb999262a | |||
067d5e68ed | |||
9bd948cc9d | |||
01ce6b6953 | |||
068a331816 | |||
226fcb5ffd | |||
06849b9edb | |||
c8933f27c8 | |||
524397acae | |||
3a6c0aca05 | |||
4aeca04c65
|
|||
d1d1353c74
|
|||
01ad3dbb82 | |||
bfb8142522 | |||
8209a15d42
|
|||
ce7f2f5206
|
|||
0ed449c27d
|
|||
7e51d6cca2
|
|||
5d5155d452
|
|||
13f8335cd2
|
|||
0aadeec095
|
|||
c07d023b5f
|
|||
e52e32a2c0
|
|||
6a999ef25d
|
|||
7918006315
|
|||
61f4423d47
|
|||
df2cae393c
|
|||
0a0d05c048
|
|||
807611ffce
|
|||
def18273f4
|
|||
0391ec2b69
|
|||
564c76c38b
|
|||
054c165954
|
|||
7fed0deb28
|
|||
372e85cc7f
|
|||
27cadd2607
|
|||
f5f4caeb1f
|
|||
f89492f79e
|
|||
9458211728
|
|||
6b71e355aa
|
|||
c53f91e840
|
|||
63cb562ac1
|
|||
acac0fe944
|
|||
e13479c190
|
|||
09cd5a7e31
|
|||
b939593445
|
|||
a03c1706d1
|
2
.drone.yml
Executable file
2
.drone.yml
Executable file
@@ -0,0 +1,2 @@
|
|||||||
|
kind: template
|
||||||
|
load: cuddle-rust-cli-plan.yaml
|
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,2 +1,2 @@
|
|||||||
something/
|
|
||||||
target/
|
target/
|
||||||
|
.cuddle/
|
||||||
|
59
CHANGELOG.md
Normal file
59
CHANGELOG.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Changelog
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [0.4.0] - 2024-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- make init zsh
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- make variant for the other shell commands
|
||||||
|
|
||||||
|
## [0.3.0] - 2024-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- make cli look nice
|
||||||
|
|
||||||
|
## [0.2.4] - 2024-12-22
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- trigger commit
|
||||||
|
|
||||||
|
## [0.2.3] - 2024-12-22
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- trigger commit
|
||||||
|
|
||||||
|
## [0.2.2] - 2024-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- trigger commit
|
||||||
|
|
||||||
|
## [0.2.1] - 2024-12-22
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- fix cargo toml
|
||||||
|
|
||||||
|
## [0.2.0] - 2024-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- transform to binary
|
||||||
|
- redo project structure
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- update lock
|
||||||
|
|
||||||
|
## [0.1.3] - 2024-12-22
|
||||||
|
|
||||||
|
### Other
|
||||||
|
- update cargo
|
||||||
|
|
||||||
|
## [0.1.2] - 2024-12-22
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- trigger commit
|
595
Cargo.lock
generated
595
Cargo.lock
generated
@@ -1,23 +1,70 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "atty"
|
name = "aho-corasick"
|
||||||
version = "0.2.14"
|
version = "1.1.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"memchr",
|
||||||
"libc",
|
]
|
||||||
"winapi",
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.18"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.59.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "1.3.2"
|
version = "2.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
@@ -27,76 +74,107 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.0.17"
|
version = "4.5.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "06badb543e734a2d6568e19a40af66ed5364360b9226184926f89d229b4b4267"
|
checksum = "be92d32e80243a54711e5d7ce823c35c41c9d929dc4ab58e1276f625841aadf9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"atty",
|
"clap_builder",
|
||||||
"bitflags",
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.5.41"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "707eab41e9622f9139419d573eca0900137718000c517d47da73045f54331c3d"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
"clap_lex",
|
"clap_lex",
|
||||||
"strsim",
|
"strsim",
|
||||||
"termcolor",
|
|
||||||
"unicase",
|
"unicase",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.3.0"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8"
|
checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
|
||||||
dependencies = [
|
|
||||||
"os_str_bytes",
|
[[package]]
|
||||||
]
|
name = "colorchoice"
|
||||||
|
version = "1.0.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.15.2"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c050367d967ced717c04b65d8c619d863ef9292ce0c5760028655a2fb298718c"
|
checksum = "2e09ced7ebbccb63b4c65413d821f2e00ce54c5ca4514ddc6b3c892fdbcbc69d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"encode_unicode",
|
"encode_unicode",
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
"libc",
|
||||||
"terminal_size",
|
"once_cell",
|
||||||
"unicode-width",
|
"unicode-width",
|
||||||
"winapi",
|
"windows-sys 0.60.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "deranged"
|
||||||
|
version = "0.3.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4"
|
||||||
|
dependencies = [
|
||||||
|
"powerfmt",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs"
|
||||||
|
version = "6.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e"
|
||||||
|
dependencies = [
|
||||||
|
"dirs-sys",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dirs-sys"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"option-ext",
|
||||||
|
"redox_users",
|
||||||
|
"windows-sys 0.60.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encode_unicode"
|
name = "encode_unicode"
|
||||||
version = "0.3.6"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
checksum = "34aa73646ffb006b8f5147f3dc182bd4bcb190227ce861fc4a4844bf8e3cb2c0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "eyre"
|
name = "eyre"
|
||||||
version = "0.6.8"
|
version = "0.6.12"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb"
|
checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indenter",
|
"indenter",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gitignore"
|
name = "getrandom"
|
||||||
version = "0.1.0"
|
version = "0.2.15"
|
||||||
dependencies = [
|
|
||||||
"clap",
|
|
||||||
"console",
|
|
||||||
"eyre",
|
|
||||||
"tracing",
|
|
||||||
"tracing-subscriber",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hermit-abi"
|
|
||||||
version = "0.1.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
|
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
"libc",
|
"libc",
|
||||||
|
"wasi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -106,31 +184,56 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "is_terminal_polyfill"
|
||||||
version = "1.0.4"
|
version = "1.70.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "itoa"
|
||||||
|
version = "1.0.14"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "kignore"
|
||||||
|
version = "0.4.0"
|
||||||
|
dependencies = [
|
||||||
|
"clap",
|
||||||
|
"console",
|
||||||
|
"dirs",
|
||||||
|
"eyre",
|
||||||
|
"tracing",
|
||||||
|
"tracing-subscriber",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lazy_static"
|
name = "lazy_static"
|
||||||
version = "1.4.0"
|
version = "1.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.135"
|
version = "0.2.169"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "68783febc7782c6c5cb401fbda4de5a9898be1762314da0bb2c10ced61f18b0c"
|
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libredox"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.17"
|
version = "0.4.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matchers"
|
name = "matchers"
|
||||||
@@ -138,9 +241,15 @@ version = "0.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex-automata",
|
"regex-automata 0.1.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "memchr"
|
||||||
|
version = "2.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nu-ansi-term"
|
name = "nu-ansi-term"
|
||||||
version = "0.46.0"
|
version = "0.46.0"
|
||||||
@@ -152,25 +261,31 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num_threads"
|
name = "num-conv"
|
||||||
version = "0.1.6"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
|
checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "num_threads"
|
||||||
|
version = "0.1.7"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.15.0"
|
version = "1.20.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e82dad04139b71a90c080c8463fe0dc7902db5192d939bd0950f074d014339e1"
|
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "os_str_bytes"
|
name = "option-ext"
|
||||||
version = "6.3.0"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9ff7415e9ae3fff1225851df9e0d9e4e5479f947619774677a63572e55e80eff"
|
checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "overload"
|
name = "overload"
|
||||||
@@ -180,35 +295,55 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.9"
|
version = "0.2.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116"
|
checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "powerfmt"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.47"
|
version = "1.0.92"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
|
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.21"
|
version = "1.0.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "redox_users"
|
||||||
version = "1.6.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b"
|
checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex-syntax",
|
"getrandom",
|
||||||
|
"libredox",
|
||||||
|
"thiserror",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex"
|
||||||
|
version = "1.11.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-automata 0.4.9",
|
||||||
|
"regex-syntax 0.8.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -217,41 +352,78 @@ version = "0.1.10"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"regex-syntax",
|
"regex-syntax 0.6.29",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-automata"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||||
|
dependencies = [
|
||||||
|
"aho-corasick",
|
||||||
|
"memchr",
|
||||||
|
"regex-syntax 0.8.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.27"
|
version = "0.6.29"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244"
|
checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "regex-syntax"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde"
|
||||||
|
version = "1.0.216"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0b9781016e935a97e8beecf0c933758c97a5520d32930e460142b4cd80c6338e"
|
||||||
|
dependencies = [
|
||||||
|
"serde_derive",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.216"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "46f859dbbf73865c6627ed570e78961cd3ac92407a2d117204c49232485da55e"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "sharded-slab"
|
name = "sharded-slab"
|
||||||
version = "0.1.4"
|
version = "0.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31"
|
checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "1.10.0"
|
version = "1.13.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
|
checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "strsim"
|
name = "strsim"
|
||||||
version = "0.10.0"
|
version = "0.11.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.102"
|
version = "2.0.91"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fcd952facd492f9be3ef0d0b7032a6e442ee9b361d4acc2b1d0c4aaa5f613a1"
|
checksum = "d53cbcb5a243bd33b7858b1d7f4aca2153490815872d86d955d6ea29f743c035"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -259,51 +431,74 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termcolor"
|
name = "thiserror"
|
||||||
version = "1.1.3"
|
version = "2.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755"
|
checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-util",
|
"thiserror-impl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "terminal_size"
|
name = "thiserror-impl"
|
||||||
version = "0.1.17"
|
version = "2.0.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df"
|
checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"proc-macro2",
|
||||||
"winapi",
|
"quote",
|
||||||
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "thread_local"
|
name = "thread_local"
|
||||||
version = "1.1.4"
|
version = "1.1.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180"
|
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.3.15"
|
version = "0.3.37"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d634a985c4d4238ec39cacaed2e7ae552fbd3c476b552c1deac3021b7d7eaf0c"
|
checksum = "35e7868883861bd0e56d9ac6efcaaca0d6d5d82a2a7ec8209ff492c07cf37b21"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"deranged",
|
||||||
"itoa",
|
"itoa",
|
||||||
"libc",
|
"libc",
|
||||||
|
"num-conv",
|
||||||
"num_threads",
|
"num_threads",
|
||||||
|
"powerfmt",
|
||||||
|
"serde",
|
||||||
|
"time-core",
|
||||||
|
"time-macros",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-core"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "time-macros"
|
||||||
|
version = "0.2.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2834e6017e3e5e4b9834939793b282bc03b37a3336245fa820e35e233e2a85de"
|
||||||
|
dependencies = [
|
||||||
|
"num-conv",
|
||||||
|
"time-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.37"
|
version = "0.1.41"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8"
|
checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
|
||||||
"log",
|
"log",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"tracing-attributes",
|
"tracing-attributes",
|
||||||
@@ -312,9 +507,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-attributes"
|
name = "tracing-attributes"
|
||||||
version = "0.1.23"
|
version = "0.1.28"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a"
|
checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -323,9 +518,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-core"
|
name = "tracing-core"
|
||||||
version = "0.1.30"
|
version = "0.1.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a"
|
checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"valuable",
|
"valuable",
|
||||||
@@ -333,20 +528,20 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-log"
|
name = "tracing-log"
|
||||||
version = "0.1.3"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922"
|
checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lazy_static",
|
|
||||||
"log",
|
"log",
|
||||||
|
"once_cell",
|
||||||
"tracing-core",
|
"tracing-core",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing-subscriber"
|
name = "tracing-subscriber"
|
||||||
version = "0.3.16"
|
version = "0.3.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70"
|
checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"matchers",
|
"matchers",
|
||||||
"nu-ansi-term",
|
"nu-ansi-term",
|
||||||
@@ -363,24 +558,27 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicase"
|
name = "unicase"
|
||||||
version = "2.6.0"
|
version = "2.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
|
checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df"
|
||||||
dependencies = [
|
|
||||||
"version_check",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.5"
|
version = "1.0.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
|
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-width"
|
name = "unicode-width"
|
||||||
version = "0.1.10"
|
version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b"
|
checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "valuable"
|
name = "valuable"
|
||||||
@@ -389,10 +587,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "wasi"
|
||||||
version = "0.9.4"
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
@@ -410,17 +608,154 @@ version = "0.4.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-util"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
name = "winapi-x86_64-pc-windows-gnu"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.59.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-sys"
|
||||||
|
version = "0.60.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
||||||
|
dependencies = [
|
||||||
|
"windows-targets 0.53.2",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm 0.52.6",
|
||||||
|
"windows_aarch64_msvc 0.52.6",
|
||||||
|
"windows_i686_gnu 0.52.6",
|
||||||
|
"windows_i686_gnullvm 0.52.6",
|
||||||
|
"windows_i686_msvc 0.52.6",
|
||||||
|
"windows_x86_64_gnu 0.52.6",
|
||||||
|
"windows_x86_64_gnullvm 0.52.6",
|
||||||
|
"windows_x86_64_msvc 0.52.6",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows-targets"
|
||||||
|
version = "0.53.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
|
||||||
|
dependencies = [
|
||||||
|
"windows_aarch64_gnullvm 0.53.0",
|
||||||
|
"windows_aarch64_msvc 0.53.0",
|
||||||
|
"windows_i686_gnu 0.53.0",
|
||||||
|
"windows_i686_gnullvm 0.53.0",
|
||||||
|
"windows_i686_msvc 0.53.0",
|
||||||
|
"windows_x86_64_gnu 0.53.0",
|
||||||
|
"windows_x86_64_gnullvm 0.53.0",
|
||||||
|
"windows_x86_64_msvc 0.53.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_aarch64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_i686_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnu"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_gnullvm"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.52.6"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "windows_x86_64_msvc"
|
||||||
|
version = "0.53.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||||
|
17
Cargo.toml
17
Cargo.toml
@@ -1,4 +1,15 @@
|
|||||||
[workspace]
|
[workspace]
|
||||||
members = [
|
members = ["crates/*"]
|
||||||
"crates/gitignore"
|
resolver = "2"
|
||||||
]
|
|
||||||
|
[workspace.package]
|
||||||
|
version = "0.4.0"
|
||||||
|
|
||||||
|
[profile.release]
|
||||||
|
opt-level = "z"
|
||||||
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
debug = false
|
||||||
|
panic = "abort"
|
||||||
|
overflow-checks = false
|
||||||
|
strip = true
|
||||||
|
7
LICENSE-MIT
Normal file
7
LICENSE-MIT
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Copyright 2022 Kasper Juul Hermansen
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
46
README.md
46
README.md
@@ -1,4 +1,4 @@
|
|||||||
# Git ignore
|
# Git ignore (kignore)
|
||||||
|
|
||||||
Is an extension for easily adding ignored files to `.gitignore files`, when
|
Is an extension for easily adding ignored files to `.gitignore files`, when
|
||||||
added it will by default also try to remove any files matching the pattern added
|
added it will by default also try to remove any files matching the pattern added
|
||||||
@@ -6,11 +6,43 @@ to .gitignore, this is by default also run in interactive mode, giving you the
|
|||||||
option to confirm or deny
|
option to confirm or deny
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ git ignore 'node_modules/'
|
$ kignore 'node_modules/'
|
||||||
|
found .gitignore .../some-path/.gitignore
|
||||||
Added node_modules/ to .gitignore
|
Added node_modules/ to .gitignore
|
||||||
Searching env for pattern...
|
Removed node_modules/ from git index
|
||||||
|
```
|
||||||
found:
|
|
||||||
<gitroot>/client/node_modules
|
```bash
|
||||||
? Remove from git state? (Y)es/(N)o/(C)ontinue/(A)bort
|
$ git ignore 'node_modules/'
|
||||||
|
found .gitignore .../some-path/.gitignore
|
||||||
|
Added node_modules/ to .gitignore
|
||||||
|
Removed node_modules/ from git index
|
||||||
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
### Cargo
|
||||||
|
|
||||||
|
Cargo will only pull the `kignore` command and won't add a subcommand to `git.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cargo install kignore
|
||||||
|
$ cargo binstall kignore # binstall will warn that git.front.kjuulh.io isn't a valid repo, it is still installable though
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Post install
|
||||||
|
|
||||||
|
To get the `git ignore` subcommand working you will need to have the file
|
||||||
|
git-ignore available on your path
|
||||||
|
|
||||||
|
```
|
||||||
|
# zsh
|
||||||
|
eval "kignore init zsh"
|
||||||
|
|
||||||
|
# shell
|
||||||
|
eval "kignore init sh"
|
||||||
|
|
||||||
|
# bash
|
||||||
|
eval "kignore init bash"
|
||||||
```
|
```
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "gitignore"
|
|
||||||
version = "0.1.0"
|
|
||||||
edition = "2021"
|
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
clap = { version = "4.0.17", features = ["env", "unicode", "string"] }
|
|
||||||
console = "0.15.2"
|
|
||||||
eyre = "0.6.8"
|
|
||||||
tracing = { version = "0.1.37", features = ["log"] }
|
|
||||||
tracing-subscriber = { version = "0.3.16", features = ["local-time", "env-filter"] }
|
|
@@ -1,191 +0,0 @@
|
|||||||
use clap::{Arg, Command};
|
|
||||||
use eyre::{Context, ContextCompat};
|
|
||||||
use std::io::prelude::*;
|
|
||||||
use std::{env::current_dir, io::Read, path::PathBuf};
|
|
||||||
|
|
||||||
fn main() -> eyre::Result<()> {
|
|
||||||
let matches = Command::new("gitignore")
|
|
||||||
.version("0.1")
|
|
||||||
.author("Kasper J. Hermansen <contact@kjuulh.io>")
|
|
||||||
.about("Easily ignore items and remove from git state")
|
|
||||||
.long_about("git ignore is a utility tool for easily adding patterns to your .gitignore file.
|
|
||||||
Easily add patterns using `git ignore <pattern>` this will by default also help you remove committed code violating these patterns
|
|
||||||
")
|
|
||||||
.propagate_version(true)
|
|
||||||
.arg(
|
|
||||||
Arg::new("pattern")
|
|
||||||
.help("the pattern you want to ignore")
|
|
||||||
.long_help("the pattern you want to ignore in the nearest .gitignore file")
|
|
||||||
.required(true),
|
|
||||||
).arg(
|
|
||||||
Arg::new("log-level").long("log-level").help("choose a log level and get more messages").long_help("Choose a log level and get more message, defaults to [INFO]"))
|
|
||||||
.get_matches();
|
|
||||||
|
|
||||||
let pattern = matches
|
|
||||||
.get_one::<String>("pattern")
|
|
||||||
.context("missing [pattern]")?;
|
|
||||||
|
|
||||||
add_gitignore_pattern(pattern)
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GitActions {
|
|
||||||
AddPattern {
|
|
||||||
git_path: PathBuf,
|
|
||||||
gitignore_path: PathBuf,
|
|
||||||
},
|
|
||||||
CreateIgnoreAndAddPattern {
|
|
||||||
git_path: PathBuf,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_gitignore_pattern(pattern: &String) -> eyre::Result<()> {
|
|
||||||
let curdir = current_dir().context(
|
|
||||||
"could not find current_dir, you may not have permission to access that directory",
|
|
||||||
)?;
|
|
||||||
let actions = match search_for_dotgitignore(&curdir)? {
|
|
||||||
// If we have an ignore path, make sure it is in a git repo as well
|
|
||||||
GitSearchResult::GitIgnore(ignorepath) => match search_for_git_root(&curdir)? {
|
|
||||||
GitSearchResult::Git(gitpath) => GitActions::AddPattern {
|
|
||||||
git_path: gitpath,
|
|
||||||
gitignore_path: ignorepath,
|
|
||||||
},
|
|
||||||
_ => return Err(eyre::anyhow!("could not find parent git directory")),
|
|
||||||
},
|
|
||||||
// Find the nearest git repo
|
|
||||||
GitSearchResult::Git(gitpath) => {
|
|
||||||
GitActions::CreateIgnoreAndAddPattern { git_path: gitpath }
|
|
||||||
} // We will always have either above, or an error so we have no default arm
|
|
||||||
};
|
|
||||||
|
|
||||||
match actions {
|
|
||||||
GitActions::AddPattern {
|
|
||||||
git_path,
|
|
||||||
gitignore_path,
|
|
||||||
} => {
|
|
||||||
let mut gitignore_file = open_gitignore_file(&gitignore_path)?;
|
|
||||||
// TODO: search for pattern in file
|
|
||||||
let mut gitignore_content = String::new();
|
|
||||||
gitignore_file
|
|
||||||
.read_to_string(&mut gitignore_content)
|
|
||||||
.context(format!(
|
|
||||||
"could not read file: {}",
|
|
||||||
gitignore_path.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
if gitignore_content.contains(pattern) {
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
|
||||||
gitignore_file
|
|
||||||
.sync_all()
|
|
||||||
.context("failed to write data to disk")?;
|
|
||||||
}
|
|
||||||
GitActions::CreateIgnoreAndAddPattern { git_path } => {
|
|
||||||
// TODO: Create gitignore file in root
|
|
||||||
let mut gitignore_file = create_gitignore_file(&git_path)?;
|
|
||||||
// TODO: do same as above
|
|
||||||
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
|
||||||
gitignore_file
|
|
||||||
.sync_all()
|
|
||||||
.context("failed to write data to disk")?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Run git rm -r --cached on the .git root
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_gitignore_file(gitroot: &PathBuf) -> eyre::Result<std::fs::File> {
|
|
||||||
let mut ignore_path = gitroot.clone();
|
|
||||||
if !ignore_path.pop() {
|
|
||||||
return Err(eyre::anyhow!("could not open parent dir"));
|
|
||||||
}
|
|
||||||
ignore_path.push(".gitignore");
|
|
||||||
let file = std::fs::File::create(ignore_path.clone()).context(format!(
|
|
||||||
"could not create file at path: {}",
|
|
||||||
ignore_path.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
|
|
||||||
Ok(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn open_gitignore_file(gitignore: &PathBuf) -> eyre::Result<std::fs::File> {
|
|
||||||
let file = std::fs::OpenOptions::new()
|
|
||||||
.read(true)
|
|
||||||
.write(true)
|
|
||||||
.open(gitignore)
|
|
||||||
.context(format!(
|
|
||||||
"could not create file at path: {}",
|
|
||||||
gitignore.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
|
|
||||||
return Ok(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GitSearchResult {
|
|
||||||
GitIgnore(PathBuf),
|
|
||||||
Git(PathBuf),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_for_git_root(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
|
||||||
if !path.is_dir() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"path is not a dir: {}",
|
|
||||||
path.to_string_lossy()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
let direntries = std::fs::read_dir(path)
|
|
||||||
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
|
||||||
for direntry in direntries {
|
|
||||||
let entry = direntry.context("could not access file")?;
|
|
||||||
|
|
||||||
let file_name = entry.file_name().to_os_string();
|
|
||||||
match file_name.to_str().context("could not convert to str")? {
|
|
||||||
".git" => return Ok(GitSearchResult::Git(entry.path())),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut upwards_par = path.clone();
|
|
||||||
if !upwards_par.pop() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"no parent exists, cannot check further, you may not be in a git repository"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
search_for_git_root(&upwards_par)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_for_dotgitignore(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
|
||||||
if !path.is_dir() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"path is not a dir: {}",
|
|
||||||
path.to_string_lossy()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
let direntries = std::fs::read_dir(path)
|
|
||||||
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
|
||||||
for direntry in direntries {
|
|
||||||
let entry = direntry.context("could not access file")?;
|
|
||||||
|
|
||||||
let file_name = entry.file_name().to_os_string();
|
|
||||||
|
|
||||||
match file_name.to_str().context("could not convert to str")? {
|
|
||||||
".gitignore" => return Ok(GitSearchResult::GitIgnore(entry.path())),
|
|
||||||
".git" => return Ok(GitSearchResult::Git(entry.path())),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut upwards_par = path.clone();
|
|
||||||
if !upwards_par.pop() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"no parent exists, cannot check further, you may not be in a git repository"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
search_for_dotgitignore(&upwards_par)
|
|
||||||
}
|
|
@@ -1,217 +0,0 @@
|
|||||||
use clap::{Arg, Command};
|
|
||||||
use eyre::{Context, ContextCompat};
|
|
||||||
use std::io::prelude::*;
|
|
||||||
use std::{env::current_dir, io::Read, path::PathBuf};
|
|
||||||
use tracing_subscriber::layer::SubscriberExt;
|
|
||||||
use tracing_subscriber::util::SubscriberInitExt;
|
|
||||||
|
|
||||||
fn main() -> eyre::Result<()> {
|
|
||||||
let matches = Command::new("gitignore")
|
|
||||||
.version("0.1")
|
|
||||||
.author("Kasper J. Hermansen <contact@kjuulh.io>")
|
|
||||||
.about("Easily ignore items and remove from git state")
|
|
||||||
.long_about("git ignore is a utility tool for easily adding patterns to your .gitignore file.
|
|
||||||
Easily add patterns using `git ignore <pattern>` this will by default also help you remove committed code violating these patterns
|
|
||||||
")
|
|
||||||
.propagate_version(true)
|
|
||||||
.arg(
|
|
||||||
Arg::new("pattern")
|
|
||||||
.help("the pattern you want to ignore")
|
|
||||||
.long_help("the pattern you want to ignore in the nearest .gitignore file")
|
|
||||||
.required(true),
|
|
||||||
).arg(
|
|
||||||
Arg::new("log-level").long("log-level").help("choose a log level and get more messages").long_help("Choose a log level and get more message, defaults to [fatal]"))
|
|
||||||
.get_matches();
|
|
||||||
|
|
||||||
let log_level = match matches.get_one::<String>("log-level").map(|f| f.as_str()) {
|
|
||||||
Some("off") => "off",
|
|
||||||
Some("info") => "info",
|
|
||||||
Some("debug") => "debug",
|
|
||||||
Some("warn") => "warn",
|
|
||||||
Some("error") => "error",
|
|
||||||
_ => "error",
|
|
||||||
};
|
|
||||||
|
|
||||||
tracing_subscriber::registry()
|
|
||||||
.with(tracing_subscriber::EnvFilter::new(format!(
|
|
||||||
"gitignore={}",
|
|
||||||
log_level
|
|
||||||
)))
|
|
||||||
.with(tracing_subscriber::fmt::layer())
|
|
||||||
.init();
|
|
||||||
|
|
||||||
let term = console::Term::stdout();
|
|
||||||
|
|
||||||
let pattern = matches
|
|
||||||
.get_one::<String>("pattern")
|
|
||||||
.context("missing [pattern]")?;
|
|
||||||
|
|
||||||
add_gitignore_pattern(term, pattern)
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GitActions {
|
|
||||||
AddPattern {
|
|
||||||
git_path: PathBuf,
|
|
||||||
gitignore_path: PathBuf,
|
|
||||||
},
|
|
||||||
CreateIgnoreAndAddPattern {
|
|
||||||
git_path: PathBuf,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
fn add_gitignore_pattern(term: console::Term, pattern: &String) -> eyre::Result<()> {
|
|
||||||
term.write_line("git ignore: Add pattern")?;
|
|
||||||
let curdir = current_dir().context(
|
|
||||||
"could not find current_dir, you may not have permission to access that directory",
|
|
||||||
)?;
|
|
||||||
let actions = match search_for_dotgitignore(&curdir)? {
|
|
||||||
// If we have an ignore path, make sure it is in a git repo as well
|
|
||||||
GitSearchResult::GitIgnore(ignorepath) => match search_for_git_root(&curdir)? {
|
|
||||||
GitSearchResult::Git(gitpath) => GitActions::AddPattern {
|
|
||||||
git_path: gitpath,
|
|
||||||
gitignore_path: ignorepath,
|
|
||||||
},
|
|
||||||
_ => return Err(eyre::anyhow!("could not find parent git directory")),
|
|
||||||
},
|
|
||||||
// Find the nearest git repo
|
|
||||||
GitSearchResult::Git(gitpath) => {
|
|
||||||
GitActions::CreateIgnoreAndAddPattern { git_path: gitpath }
|
|
||||||
} // We will always have either above, or an error so we have no default arm
|
|
||||||
};
|
|
||||||
|
|
||||||
match actions {
|
|
||||||
GitActions::AddPattern {
|
|
||||||
git_path,
|
|
||||||
gitignore_path,
|
|
||||||
} => {
|
|
||||||
term.write_line("Found existing .gitignore")?;
|
|
||||||
let mut gitignore_file = open_gitignore_file(&gitignore_path)?;
|
|
||||||
let mut gitignore_content = String::new();
|
|
||||||
gitignore_file
|
|
||||||
.read_to_string(&mut gitignore_content)
|
|
||||||
.context(format!(
|
|
||||||
"could not read file: {}",
|
|
||||||
gitignore_path.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
if gitignore_content.contains(pattern) {
|
|
||||||
term.write_line(".gitignore already contains pattern, skipping")?;
|
|
||||||
return Ok(());
|
|
||||||
}
|
|
||||||
|
|
||||||
term.write_line("adding pattern to file")?;
|
|
||||||
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
|
||||||
gitignore_file
|
|
||||||
.sync_all()
|
|
||||||
.context("failed to write data to disk")?;
|
|
||||||
}
|
|
||||||
GitActions::CreateIgnoreAndAddPattern { git_path } => {
|
|
||||||
term.write_line(
|
|
||||||
"could not find .gitignore file, creating one in the root of the git repository",
|
|
||||||
)?;
|
|
||||||
let mut gitignore_file = create_gitignore_file(&git_path)?;
|
|
||||||
term.write_line("adding pattern to file")?;
|
|
||||||
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
|
||||||
gitignore_file
|
|
||||||
.sync_all()
|
|
||||||
.context("failed to write data to disk")?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO: Run git rm -r --cached on the .git root
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_gitignore_file(gitroot: &PathBuf) -> eyre::Result<std::fs::File> {
|
|
||||||
let mut ignore_path = gitroot.clone();
|
|
||||||
if !ignore_path.pop() {
|
|
||||||
return Err(eyre::anyhow!("could not open parent dir"));
|
|
||||||
}
|
|
||||||
ignore_path.push(".gitignore");
|
|
||||||
let file = std::fs::File::create(ignore_path.clone()).context(format!(
|
|
||||||
"could not create file at path: {}",
|
|
||||||
ignore_path.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
|
|
||||||
Ok(file)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn open_gitignore_file(gitignore: &PathBuf) -> eyre::Result<std::fs::File> {
|
|
||||||
let file = std::fs::OpenOptions::new()
|
|
||||||
.read(true)
|
|
||||||
.write(true)
|
|
||||||
.open(gitignore)
|
|
||||||
.context(format!(
|
|
||||||
"could not create file at path: {}",
|
|
||||||
gitignore.to_string_lossy()
|
|
||||||
))?;
|
|
||||||
|
|
||||||
return Ok(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum GitSearchResult {
|
|
||||||
GitIgnore(PathBuf),
|
|
||||||
Git(PathBuf),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_for_git_root(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
|
||||||
if !path.is_dir() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"path is not a dir: {}",
|
|
||||||
path.to_string_lossy()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
let direntries = std::fs::read_dir(path)
|
|
||||||
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
|
||||||
for direntry in direntries {
|
|
||||||
let entry = direntry.context("could not access file")?;
|
|
||||||
|
|
||||||
let file_name = entry.file_name().to_os_string();
|
|
||||||
match file_name.to_str().context("could not convert to str")? {
|
|
||||||
".git" => return Ok(GitSearchResult::Git(entry.path())),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut upwards_par = path.clone();
|
|
||||||
if !upwards_par.pop() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"no parent exists, cannot check further, you may not be in a git repository"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
search_for_git_root(&upwards_par)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn search_for_dotgitignore(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
|
||||||
if !path.is_dir() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"path is not a dir: {}",
|
|
||||||
path.to_string_lossy()
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
let direntries = std::fs::read_dir(path)
|
|
||||||
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
|
||||||
for direntry in direntries {
|
|
||||||
let entry = direntry.context("could not access file")?;
|
|
||||||
|
|
||||||
let file_name = entry.file_name().to_os_string();
|
|
||||||
|
|
||||||
match file_name.to_str().context("could not convert to str")? {
|
|
||||||
".gitignore" => return Ok(GitSearchResult::GitIgnore(entry.path())),
|
|
||||||
".git" => return Ok(GitSearchResult::Git(entry.path())),
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut upwards_par = path.clone();
|
|
||||||
if !upwards_par.pop() {
|
|
||||||
return Err(eyre::anyhow!(
|
|
||||||
"no parent exists, cannot check further, you may not be in a git repository"
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
search_for_dotgitignore(&upwards_par)
|
|
||||||
}
|
|
28
crates/kignore/Cargo.toml
Normal file
28
crates/kignore/Cargo.toml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[package]
|
||||||
|
name = "kignore"
|
||||||
|
version.workspace = true
|
||||||
|
authors = ["Kasper J. Hermansen <contact@kjuulh.io>"]
|
||||||
|
license = "MIT"
|
||||||
|
readme = "../../README.md"
|
||||||
|
keywords = ["git", "ignore", "clap", "interactive"]
|
||||||
|
repository = "https://git.front.kjuulh.io/kjuulh/gitignore"
|
||||||
|
documentation = "https://docs.rs/kignore"
|
||||||
|
description = """
|
||||||
|
kignore is a tool for easily adding patterns to .gitignore and cleaning up afterwards
|
||||||
|
"""
|
||||||
|
categories = ["command-line-interface"]
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
clap = { version = "4.5.4", features = ["env", "unicode", "string"] }
|
||||||
|
console = "0.16.0"
|
||||||
|
dirs = "6.0.0"
|
||||||
|
eyre = "0.6.12"
|
||||||
|
tracing = { version = "0.1.40", features = ["log"] }
|
||||||
|
tracing-subscriber = { version = "0.3.18", features = [
|
||||||
|
"local-time",
|
||||||
|
"env-filter",
|
||||||
|
] }
|
349
crates/kignore/src/main.rs
Normal file
349
crates/kignore/src/main.rs
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
use clap::{Arg, Command};
|
||||||
|
use console::style;
|
||||||
|
use eyre::{Context, ContextCompat, OptionExt};
|
||||||
|
use std::io::prelude::*;
|
||||||
|
use std::os::unix::fs::PermissionsExt;
|
||||||
|
use std::{env::current_dir, io::Read, path::PathBuf};
|
||||||
|
use tracing_subscriber::layer::SubscriberExt;
|
||||||
|
use tracing_subscriber::util::SubscriberInitExt;
|
||||||
|
|
||||||
|
const ZSH_FILE_CONTENTS: &[u8] = b"#!/usr/bin/env zsh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
kignore $@
|
||||||
|
";
|
||||||
|
|
||||||
|
const SH_FILE_CONTENTS: &[u8] = b"#!/usr/bin/env sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
kignore $@
|
||||||
|
";
|
||||||
|
|
||||||
|
const BASH_FILE_CONTENTS: &[u8] = b"#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
kignore $@
|
||||||
|
";
|
||||||
|
|
||||||
|
pub fn main() -> eyre::Result<()> {
|
||||||
|
let matches = Command::new("gitignore")
|
||||||
|
.version("0.1")
|
||||||
|
.author("Kasper J. Hermansen <contact@kjuulh.io>")
|
||||||
|
.about("Easily ignore items and remove from git state")
|
||||||
|
.long_about(
|
||||||
|
"git ignore is a utility tool for easily adding patterns to your .gitignore file.
|
||||||
|
Easily add patterns using `git ignore <pattern>` this will by default
|
||||||
|
also help you remove committed code violating these patterns
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.propagate_version(true)
|
||||||
|
.arg(
|
||||||
|
Arg::new("pattern")
|
||||||
|
.help("the pattern you want to ignore")
|
||||||
|
.long_help("the pattern you want to ignore in the nearest .gitignore file"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("log-level")
|
||||||
|
.long("log-level")
|
||||||
|
.default_value("warn")
|
||||||
|
.help("choose a log level and get more messages")
|
||||||
|
.long_help("Choose a log level and get more message, defaults to [warn]"),
|
||||||
|
)
|
||||||
|
.subcommand(
|
||||||
|
clap::Command::new("init")
|
||||||
|
.subcommand_required(true)
|
||||||
|
.subcommand(Command::new("zsh"))
|
||||||
|
.subcommand(Command::new("sh"))
|
||||||
|
.subcommand(Command::new("bash")),
|
||||||
|
)
|
||||||
|
.get_matches();
|
||||||
|
|
||||||
|
match matches.subcommand() {
|
||||||
|
Some(("init", args)) => match args
|
||||||
|
.subcommand()
|
||||||
|
.expect("should never be able to call on init")
|
||||||
|
{
|
||||||
|
("zsh", _) => init_script(ShellType::Zsh),
|
||||||
|
("bash", _) => init_script(ShellType::Bash),
|
||||||
|
("sh", _) => init_script(ShellType::Shell),
|
||||||
|
(subcommand, _) => {
|
||||||
|
panic!("cannot call on subcommand: {}", subcommand);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ => {
|
||||||
|
let log_level = match matches.get_one::<String>("log-level").map(|f| f.as_str()) {
|
||||||
|
Some("off") => "off",
|
||||||
|
Some("info") => "info",
|
||||||
|
Some("debug") => "debug",
|
||||||
|
Some("warn") => "warn",
|
||||||
|
Some("error") => "error",
|
||||||
|
_ => "error",
|
||||||
|
};
|
||||||
|
|
||||||
|
tracing_subscriber::registry()
|
||||||
|
.with(tracing_subscriber::EnvFilter::new(format!(
|
||||||
|
"gitignore={}",
|
||||||
|
log_level
|
||||||
|
)))
|
||||||
|
.with(tracing_subscriber::fmt::layer())
|
||||||
|
.init();
|
||||||
|
|
||||||
|
let term = console::Term::stdout();
|
||||||
|
|
||||||
|
let pattern = matches
|
||||||
|
.get_one::<String>("pattern")
|
||||||
|
.context("missing [pattern]")?;
|
||||||
|
|
||||||
|
add_gitignore_pattern(term, pattern)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GitActions {
|
||||||
|
AddPattern { gitignore_path: PathBuf },
|
||||||
|
CreateIgnoreAndAddPattern { git_path: PathBuf },
|
||||||
|
}
|
||||||
|
|
||||||
|
fn add_gitignore_pattern(term: console::Term, pattern: &String) -> eyre::Result<()> {
|
||||||
|
println!("git ignore: Add pattern");
|
||||||
|
let curdir = current_dir().context(
|
||||||
|
"could not find current_dir, you may not have permission to access that directory",
|
||||||
|
)?;
|
||||||
|
let actions = match search_for_dotgitignore(&curdir)? {
|
||||||
|
// If we have an ignore path, make sure it is in a git repo as well
|
||||||
|
GitSearchResult::GitIgnore(ignorepath) => match search_for_git_root(&curdir)? {
|
||||||
|
GitSearchResult::Git(_gitpath) => GitActions::AddPattern {
|
||||||
|
gitignore_path: ignorepath,
|
||||||
|
},
|
||||||
|
_ => return Err(eyre::anyhow!("could not find parent git directory")),
|
||||||
|
},
|
||||||
|
// Find the nearest git repo
|
||||||
|
GitSearchResult::Git(gitpath) => {
|
||||||
|
GitActions::CreateIgnoreAndAddPattern { git_path: gitpath }
|
||||||
|
} // We will always have either above, or an error so we have no default arm
|
||||||
|
};
|
||||||
|
|
||||||
|
match actions {
|
||||||
|
GitActions::AddPattern { gitignore_path } => {
|
||||||
|
println!("Found existing {}", style(".gitignore").green());
|
||||||
|
let mut gitignore_file = open_gitignore_file(&gitignore_path)?;
|
||||||
|
let mut gitignore_content = String::new();
|
||||||
|
gitignore_file
|
||||||
|
.read_to_string(&mut gitignore_content)
|
||||||
|
.context(format!(
|
||||||
|
"could not read file: {}",
|
||||||
|
gitignore_path.to_string_lossy()
|
||||||
|
))?;
|
||||||
|
if gitignore_content.contains(pattern) {
|
||||||
|
println!(
|
||||||
|
".gitignore already contains pattern, {}",
|
||||||
|
style("skipping...").blue()
|
||||||
|
);
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("adding pattern to file");
|
||||||
|
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
||||||
|
gitignore_file
|
||||||
|
.sync_all()
|
||||||
|
.context("failed to write data to disk")?;
|
||||||
|
}
|
||||||
|
GitActions::CreateIgnoreAndAddPattern { git_path } => {
|
||||||
|
println!(
|
||||||
|
"could not find {} file, creating one in the root of the git repository",
|
||||||
|
style(".gitignore").yellow()
|
||||||
|
);
|
||||||
|
let mut gitignore_file = create_gitignore_file(git_path)?;
|
||||||
|
println!("adding pattern to file");
|
||||||
|
writeln!(gitignore_file, "{}", pattern).context("could not write contents to file")?;
|
||||||
|
gitignore_file
|
||||||
|
.sync_all()
|
||||||
|
.context("failed to write data to disk")?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Run git rm -r --cached --pathspec <pattern> on the .git root
|
||||||
|
let output = std::process::Command::new("git")
|
||||||
|
.arg("rm")
|
||||||
|
.arg("-r")
|
||||||
|
.arg("--cached")
|
||||||
|
.arg("-f")
|
||||||
|
.arg("--ignore-unmatch")
|
||||||
|
.arg(pattern)
|
||||||
|
.output()
|
||||||
|
.context("could not process git remove from index command")?;
|
||||||
|
String::from_utf8(output.stdout)?
|
||||||
|
.lines()
|
||||||
|
.chain(String::from_utf8(output.stderr)?.lines())
|
||||||
|
.map(|l| {
|
||||||
|
// make rm 'path' look nice
|
||||||
|
if l.contains("rm") {
|
||||||
|
if let Some((_, pruned_first)) = l.split_once("'") {
|
||||||
|
if let Some((content, _)) = pruned_first.rsplit_once("'") {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
l
|
||||||
|
})
|
||||||
|
.for_each(|l| println!("removed from git history: {}", style(l).yellow()));
|
||||||
|
|
||||||
|
if !output.status.success() {
|
||||||
|
return Err(eyre::anyhow!("failed to run git index command"));
|
||||||
|
}
|
||||||
|
|
||||||
|
term.write_line("git successfully removed files")?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn create_gitignore_file(gitroot: PathBuf) -> eyre::Result<std::fs::File> {
|
||||||
|
let mut ignore_path = gitroot.clone();
|
||||||
|
if !ignore_path.pop() {
|
||||||
|
return Err(eyre::anyhow!("could not open parent dir"));
|
||||||
|
}
|
||||||
|
ignore_path.push(".gitignore");
|
||||||
|
let file = std::fs::File::create(ignore_path.clone()).context(format!(
|
||||||
|
"could not create file at path: {}",
|
||||||
|
ignore_path.to_string_lossy()
|
||||||
|
))?;
|
||||||
|
|
||||||
|
Ok(file)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn open_gitignore_file(gitignore: &PathBuf) -> eyre::Result<std::fs::File> {
|
||||||
|
let file = std::fs::OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.open(gitignore)
|
||||||
|
.context(format!(
|
||||||
|
"could not create file at path: {}",
|
||||||
|
gitignore.to_string_lossy()
|
||||||
|
))?;
|
||||||
|
|
||||||
|
Ok(file)
|
||||||
|
}
|
||||||
|
|
||||||
|
enum GitSearchResult {
|
||||||
|
GitIgnore(PathBuf),
|
||||||
|
Git(PathBuf),
|
||||||
|
}
|
||||||
|
|
||||||
|
fn search_for_git_root(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
||||||
|
if !path.is_dir() {
|
||||||
|
return Err(eyre::anyhow!(
|
||||||
|
"path is not a dir: {}",
|
||||||
|
path.to_string_lossy()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let direntries = std::fs::read_dir(path)
|
||||||
|
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
||||||
|
for direntry in direntries {
|
||||||
|
let entry = direntry.context("could not access file")?;
|
||||||
|
|
||||||
|
let file_name = entry.file_name().to_os_string();
|
||||||
|
if file_name.to_str().context("could not convert to str")? == ".git" {
|
||||||
|
return Ok(GitSearchResult::Git(entry.path()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut upwards_par = path.clone();
|
||||||
|
if !upwards_par.pop() {
|
||||||
|
return Err(eyre::anyhow!(
|
||||||
|
"no parent exists, cannot check further, you may not be in a git repository"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
search_for_git_root(&upwards_par)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn search_for_dotgitignore(path: &PathBuf) -> eyre::Result<GitSearchResult> {
|
||||||
|
if !path.is_dir() {
|
||||||
|
return Err(eyre::anyhow!(
|
||||||
|
"path is not a dir: {}",
|
||||||
|
path.to_string_lossy()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
let direntries = std::fs::read_dir(path)
|
||||||
|
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
||||||
|
for direntry in direntries {
|
||||||
|
let entry = direntry.context("could not access file")?;
|
||||||
|
|
||||||
|
let file_name = entry.file_name().to_os_string();
|
||||||
|
|
||||||
|
if file_name.to_str().context("could not convert to str")? == ".gitignore" {
|
||||||
|
return Ok(GitSearchResult::GitIgnore(entry.path()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let direntries = std::fs::read_dir(path)
|
||||||
|
.context(format!("could not open dir: {}", path.to_string_lossy()))?;
|
||||||
|
for direntry in direntries {
|
||||||
|
let entry = direntry.context("could not access file")?;
|
||||||
|
|
||||||
|
let file_name = entry.file_name().to_os_string();
|
||||||
|
|
||||||
|
if file_name.to_str().context("could not convert to str")? == ".git" {
|
||||||
|
return Ok(GitSearchResult::Git(entry.path()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut upwards_par = path.clone();
|
||||||
|
if !upwards_par.pop() {
|
||||||
|
return Err(eyre::anyhow!(
|
||||||
|
"no parent exists, cannot check further, you may not be in a git repository"
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
search_for_dotgitignore(&upwards_par)
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ShellType {
|
||||||
|
Bash,
|
||||||
|
Shell,
|
||||||
|
Zsh,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn init_script(shell: ShellType) -> eyre::Result<()> {
|
||||||
|
let bin_dir = dirs::executable_dir().ok_or_eyre("failed to find executable dir")?;
|
||||||
|
|
||||||
|
let script = match shell {
|
||||||
|
ShellType::Bash => BASH_FILE_CONTENTS,
|
||||||
|
ShellType::Shell => SH_FILE_CONTENTS,
|
||||||
|
ShellType::Zsh => ZSH_FILE_CONTENTS,
|
||||||
|
};
|
||||||
|
|
||||||
|
let alias_script = bin_dir.join("git-ignore");
|
||||||
|
if let Ok(existing_file) = std::fs::read(&alias_script) {
|
||||||
|
if existing_file == script {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
std::fs::create_dir_all(&bin_dir).context("failed to create bin dir")?;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut file = std::fs::OpenOptions::new()
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.truncate(true)
|
||||||
|
.open(&alias_script)?;
|
||||||
|
|
||||||
|
file.write_all(script)?;
|
||||||
|
file.flush()?;
|
||||||
|
|
||||||
|
// Set the file to be executable
|
||||||
|
let metadata = file.metadata()?;
|
||||||
|
let mut permissions = metadata.permissions();
|
||||||
|
permissions.set_mode(0o755); // rwxr-xr-x
|
||||||
|
file.set_permissions(permissions)?;
|
||||||
|
|
||||||
|
println!(
|
||||||
|
"successfully wrote alias to {}",
|
||||||
|
style(alias_script.display()).green()
|
||||||
|
);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
28
cuddle.yaml
Normal file
28
cuddle.yaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# yaml-language-server: $schema=https://git.front.kjuulh.io/kjuulh/cuddle/raw/branch/main/schemas/base.json
|
||||||
|
|
||||||
|
base: "git@git.front.kjuulh.io:kjuulh/cuddle-rust-cli-plan.git"
|
||||||
|
|
||||||
|
vars:
|
||||||
|
service: "kignore"
|
||||||
|
registry: kasperhermansen
|
||||||
|
|
||||||
|
rust:
|
||||||
|
publish: {}
|
||||||
|
|
||||||
|
please:
|
||||||
|
project:
|
||||||
|
owner: kjuulh
|
||||||
|
repository: gitignore
|
||||||
|
branch: main
|
||||||
|
settings:
|
||||||
|
api_url: https://git.front.kjuulh.io
|
||||||
|
actions:
|
||||||
|
rust:
|
||||||
|
|
||||||
|
components:
|
||||||
|
packages:
|
||||||
|
debian:
|
||||||
|
dev:
|
||||||
|
- git
|
||||||
|
release:
|
||||||
|
- git
|
3
renovate.json
Normal file
3
renovate.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
||||||
|
}
|
Reference in New Issue
Block a user