Compare commits

..

No commits in common. "a7c81d59767236706c28a58137adf8c03312bf4d" and "0f7095b229d7554772adf56c3beb6d0d48b05670" have entirely different histories.

9 changed files with 108 additions and 485 deletions

View file

@ -1,14 +1,5 @@
# Changelog # Changelog
## [0.2.1] - 2024-06-19
### Changed
- Dependencies are updated.
- Format of storage size printing has been changed due to the update of byte-unit.
### Fixed
- `libgit2-sys` was updated due to the security issue.
## [0.2.0] - 2024-05-21 ## [0.2.0] - 2024-05-21
### Changed ### Changed
@ -30,6 +21,5 @@
- `backup done` subcommand - `backup done` subcommand
- `completion` subcommand - `completion` subcommand
[0.2.1]: https://github.com/qwjyh/xdbm/compare/v0.2.0...v0.2.1
[0.2.0]: https://github.com/qwjyh/xdbm/releases/tag/v0.2.0 [0.2.0]: https://github.com/qwjyh/xdbm/releases/tag/v0.2.0
[0.1.0]: https://github.com/qwjyh/xdbm/releases/tag/v0.1.0 [0.1.0]: https://github.com/qwjyh/xdbm/releases/tag/v0.1.0

487
Cargo.lock generated
View file

@ -2,17 +2,6 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "ahash"
version = "0.7.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9"
dependencies = [
"getrandom",
"once_cell",
"version_check",
]
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "1.1.3" version = "1.1.3"
@ -92,12 +81,6 @@ version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da"
[[package]]
name = "arrayvec"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
version = "2.0.14" version = "2.0.14"
@ -146,42 +129,6 @@ version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "bitvec"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c"
dependencies = [
"funty",
"radium",
"tap",
"wyz",
]
[[package]]
name = "borsh"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed"
dependencies = [
"borsh-derive",
"cfg_aliases",
]
[[package]]
name = "borsh-derive"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b"
dependencies = [
"once_cell",
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.66",
"syn_derive",
]
[[package]] [[package]]
name = "bstr" name = "bstr"
version = "1.9.1" version = "1.9.1"
@ -201,49 +148,14 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
[[package]] [[package]]
name = "byte-unit" name = "byte-unit"
version = "5.1.4" version = "4.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33ac19bdf0b2665407c39d82dbc937e951e7e2001609f0fb32edd0af45a2d63e" checksum = "da78b32057b8fdfc352504708feeba7216dcd65a2c9ab02978cbd288d1279b6c"
dependencies = [ dependencies = [
"rust_decimal",
"serde", "serde",
"utf8-width", "utf8-width",
] ]
[[package]]
name = "bytecheck"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2"
dependencies = [
"bytecheck_derive",
"ptr_meta",
"simdutf8",
]
[[package]]
name = "bytecheck_derive"
version = "0.6.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "bytes"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.99" version = "1.0.99"
@ -261,12 +173,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 = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cfg_aliases"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
[[package]] [[package]]
name = "chrono" name = "chrono"
version = "0.4.38" version = "0.4.38"
@ -332,7 +238,7 @@ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.66", "syn",
] ]
[[package]] [[package]]
@ -455,26 +361,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b"
[[package]] [[package]]
name = "env_filter" name = "env_logger"
version = "0.1.0" version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a009aa4810eb158359dda09d0c87378e4bbb89b5a801f016885a4707ba24f7ea" checksum = "4cd405aab171cb85d6735e5c8d9db038c17d3ca007a4d2c25f337935c3d90580"
dependencies = [ dependencies = [
"humantime",
"is-terminal",
"log", "log",
"regex", "regex",
] "termcolor",
[[package]]
name = "env_logger"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38b35839ba51819680ba087cd351788c9a3c476841207e0b8cee0b04722343b9"
dependencies = [
"anstream",
"anstyle",
"env_filter",
"humantime",
"log",
] ]
[[package]] [[package]]
@ -517,30 +413,6 @@ dependencies = [
"percent-encoding", "percent-encoding",
] ]
[[package]]
name = "funty"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c"
[[package]]
name = "fuzzy-matcher"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94"
dependencies = [
"thread_local",
]
[[package]]
name = "fxhash"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
dependencies = [
"byteorder",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.2.15" version = "0.2.15"
@ -591,15 +463,6 @@ dependencies = [
"walkdir", "walkdir",
] ]
[[package]]
name = "hashbrown"
version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [
"ahash",
]
[[package]] [[package]]
name = "hashbrown" name = "hashbrown"
version = "0.14.5" version = "0.14.5"
@ -612,6 +475,12 @@ 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 = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
[[package]]
name = "hermit-abi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024"
[[package]] [[package]]
name = "humantime" name = "humantime"
version = "2.1.0" version = "2.1.0"
@ -674,26 +543,36 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
dependencies = [ dependencies = [
"equivalent", "equivalent",
"hashbrown 0.14.5", "hashbrown",
] ]
[[package]] [[package]]
name = "inquire" name = "inquire"
version = "0.7.5" version = "0.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a" checksum = "c33e7c1ddeb15c9abcbfef6029d8e29f69b52b6d6c891031b88ed91b5065803b"
dependencies = [ dependencies = [
"bitflags 2.5.0", "bitflags 1.3.2",
"crossterm", "crossterm",
"dyn-clone", "dyn-clone",
"fuzzy-matcher", "lazy_static",
"fxhash",
"newline-converter", "newline-converter",
"once_cell", "thiserror",
"unicode-segmentation", "unicode-segmentation",
"unicode-width", "unicode-width",
] ]
[[package]]
name = "is-terminal"
version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f23ff5ef2b80d608d61efee834934d862cd92461afc0560dedf493e4c033738b"
dependencies = [
"hermit-abi",
"libc",
"windows-sys 0.52.0",
]
[[package]] [[package]]
name = "is_terminal_polyfill" name = "is_terminal_polyfill"
version = "1.70.0" version = "1.70.0"
@ -724,6 +603,12 @@ dependencies = [
"wasm-bindgen", "wasm-bindgen",
] ]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.155" version = "0.2.155"
@ -822,9 +707,9 @@ dependencies = [
[[package]] [[package]]
name = "newline-converter" name = "newline-converter"
version = "0.3.0" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47b6b097ecb1cbfed438542d16e84fd7ad9b0c76c8a65b7f9039212a3d14dc7f" checksum = "1f71d09d5c87634207f894c6b31b6a2b2c64ea3bdcf71bd5599fdbbe1600c00f"
dependencies = [ dependencies = [
"unicode-segmentation", "unicode-segmentation",
] ]
@ -924,12 +809,6 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "3.1.0" version = "3.1.0"
@ -960,38 +839,6 @@ dependencies = [
"termtree", "termtree",
] ]
[[package]]
name = "proc-macro-crate"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284"
dependencies = [
"toml_edit",
]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro2" name = "proc-macro2"
version = "1.0.85" version = "1.0.85"
@ -1001,26 +848,6 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "ptr_meta"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1"
dependencies = [
"ptr_meta_derive",
]
[[package]]
name = "ptr_meta_derive"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "quote" name = "quote"
version = "1.0.36" version = "1.0.36"
@ -1030,42 +857,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "radium"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
name = "rand"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
dependencies = [
"getrandom",
]
[[package]] [[package]]
name = "rayon" name = "rayon"
version = "1.10.0" version = "1.10.0"
@ -1135,60 +926,6 @@ version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "rend"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c"
dependencies = [
"bytecheck",
]
[[package]]
name = "rkyv"
version = "0.7.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0"
dependencies = [
"bitvec",
"bytecheck",
"bytes",
"hashbrown 0.12.3",
"ptr_meta",
"rend",
"rkyv_derive",
"seahash",
"tinyvec",
"uuid",
]
[[package]]
name = "rkyv_derive"
version = "0.7.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "rust_decimal"
version = "1.35.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a"
dependencies = [
"arrayvec",
"borsh",
"bytes",
"num-traits",
"rand",
"rkyv",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "rustix" name = "rustix"
version = "0.38.34" version = "0.38.34"
@ -1223,12 +960,6 @@ version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
name = "seahash"
version = "4.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.203" version = "1.0.203"
@ -1246,18 +977,7 @@ checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.66", "syn",
]
[[package]]
name = "serde_json"
version = "1.0.117"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"
dependencies = [
"itoa",
"ryu",
"serde",
] ]
[[package]] [[package]]
@ -1303,12 +1023,6 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "simdutf8"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
version = "1.13.2" version = "1.13.2"
@ -1321,17 +1035,6 @@ 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 = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "2.0.66" version = "2.0.66"
@ -1343,23 +1046,11 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "syn_derive"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"syn 2.0.66",
]
[[package]] [[package]]
name = "sysinfo" name = "sysinfo"
version = "0.30.12" version = "0.29.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "732ffa00f53e6b2af46208fba5718d9662a421049204e156328b66791ffa15ae" checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"core-foundation-sys", "core-foundation-sys",
@ -1368,15 +1059,9 @@ dependencies = [
"once_cell", "once_cell",
"rayon", "rayon",
"serde", "serde",
"windows", "winapi",
] ]
[[package]]
name = "tap"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.10.1" version = "3.10.1"
@ -1389,6 +1074,15 @@ dependencies = [
"windows-sys 0.52.0", "windows-sys 0.52.0",
] ]
[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]] [[package]]
name = "termtree" name = "termtree"
version = "0.4.1" version = "0.4.1"
@ -1412,17 +1106,7 @@ checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.66", "syn",
]
[[package]]
name = "thread_local"
version = "1.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c"
dependencies = [
"cfg-if",
"once_cell",
] ]
[[package]] [[package]]
@ -1440,23 +1124,6 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "toml_datetime"
version = "0.6.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf"
[[package]]
name = "toml_edit"
version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
dependencies = [
"indexmap",
"toml_datetime",
"winnow",
]
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.15" version = "0.3.15"
@ -1519,24 +1186,12 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]]
name = "uuid"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0"
[[package]] [[package]]
name = "vcpkg" name = "vcpkg"
version = "0.2.15" 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 = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "wait-timeout" name = "wait-timeout"
version = "0.2.0" version = "0.2.0"
@ -1583,7 +1238,7 @@ dependencies = [
"once_cell", "once_cell",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.66", "syn",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -1605,7 +1260,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.66", "syn",
"wasm-bindgen-backend", "wasm-bindgen-backend",
"wasm-bindgen-shared", "wasm-bindgen-shared",
] ]
@ -1647,16 +1302,6 @@ 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"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be"
dependencies = [
"windows-core",
"windows-targets 0.52.5",
]
[[package]] [[package]]
name = "windows-core" name = "windows-core"
version = "0.52.0" version = "0.52.0"
@ -1805,27 +1450,9 @@ version = "0.52.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
[[package]]
name = "winnow"
version = "0.5.40"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876"
dependencies = [
"memchr",
]
[[package]]
name = "wyz"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed"
dependencies = [
"tap",
]
[[package]] [[package]]
name = "xdbm" name = "xdbm"
version = "0.2.1" version = "0.2.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"assert_cmd", "assert_cmd",

View file

@ -1,6 +1,6 @@
[package] [package]
name = "xdbm" name = "xdbm"
version = "0.2.1" version = "0.2.0"
authors = ["qwjyh <urataw421@gmail.com>"] authors = ["qwjyh <urataw421@gmail.com>"]
edition = "2021" edition = "2021"
description = "Cross device backup manager, which manages backups on several storages mounted on multiple devices." description = "Cross device backup manager, which manages backups on several storages mounted on multiple devices."
@ -14,22 +14,22 @@ keywords = ["cli", "backup"]
[dependencies] [dependencies]
clap = { version = "4.4.0", features = ["cargo", "derive"] } clap = { version = "4.4.0", features = ["cargo", "derive"] }
sysinfo = { version = "0.30", features = ["serde"] } sysinfo = { version = "0.29.8", features = ["serde"] }
log = "0.4" log = "0.4"
clap-verbosity-flag = "2.2" clap-verbosity-flag = "2.0.1"
clap_complete = "4.5" clap_complete = "4.5.1"
chrono = { version = "0.4", features = ["serde"] } chrono = { version = "0.4.35", features = ["serde"] }
env_logger = "0.11.3" env_logger = "0.10.0"
inquire = "0.7.5" inquire = "0.6.2"
git2 = "0.19" git2 = "0.19"
dirs = "5.0" dirs = "5.0"
dunce = "1.0.4" dunce = "1.0.4"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_yaml = "0.9" serde_yaml = "0.9"
byte-unit = "5.1.4" byte-unit = "4.0.19"
anyhow = "1.0" anyhow = "1.0"
pathdiff = "0.2.1" pathdiff = "0.2.1"
unicode-width = "0.1.13" unicode-width = "0.1.11"
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.14" assert_cmd = "2.0.14"

View file

@ -44,7 +44,7 @@ fn clone_repo(
.context("No username found from the url") .context("No username found from the url")
.unwrap(), .unwrap(),
None, None,
key as &Path, &key as &Path,
passwd.as_deref(), passwd.as_deref(),
) )
} else if use_sshagent { } else if use_sshagent {

View file

@ -6,7 +6,7 @@ use std::{
}; };
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use byte_unit::{Byte, UnitType}; use byte_unit::Byte;
use dunce::canonicalize; use dunce::canonicalize;
use git2::Repository; use git2::Repository;
use inquire::{Confirm, CustomType, Text}; use inquire::{Confirm, CustomType, Text};
@ -197,11 +197,10 @@ fn write_storages_list(
trace!("name widths: {}", name_width); trace!("name widths: {}", name_width);
for storage in storages.list.values() { for storage in storages.list.values() {
let size_str = match storage.capacity() { let size_str = match storage.capacity() {
Some(b) => { Some(b) => Byte::from_bytes(b.into())
let size = Byte::from_u64(b).get_appropriate_unit(UnitType::Binary); .get_appropriate_unit(true)
// TODO: split case for 500GB and 1.5TB? .format(0)
format!("{:>+5.1}", size) .to_string(),
}
None => "".to_string(), None => "".to_string(),
}; };
let isremovable = if let Storage::Physical(s) = storage { let isremovable = if let Storage::Physical(s) = storage {
@ -229,7 +228,7 @@ fn write_storages_list(
}; };
writeln!( writeln!(
writer, writer,
"{stype}{isremovable}: {name:<name_width$} {size:>10} {parent:<name_width$} {path}", "{stype}{isremovable}: {name:<name_width$} {size:>8} {parent:<name_width$} {path}",
stype = storage.shorttypename(), stype = storage.shorttypename(),
isremovable = isremovable, isremovable = isremovable,
name = storage.name(), name = storage.name(),

View file

@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
use std::fs::{File, OpenOptions}; use std::fs::{File, OpenOptions};
use std::io::{BufRead, BufReader, BufWriter}; use std::io::{BufRead, BufReader, BufWriter};
use std::path::Path; use std::path::Path;
use sysinfo::System; use sysinfo::{System, SystemExt};
/// YAML file to store known devices. /// YAML file to store known devices.
pub const DEVICESFILE: &str = "devices.yml"; pub const DEVICESFILE: &str = "devices.yml";
@ -25,17 +25,18 @@ impl Device {
/// Create new `Device` of name `name`. Additional data is obtained via sysinfo. /// Create new `Device` of name `name`. Additional data is obtained via sysinfo.
/// Filling fields which one failed to get is filled with "unknown". /// Filling fields which one failed to get is filled with "unknown".
pub fn new(name: String) -> Device { pub fn new(name: String) -> Device {
let sys = System::new();
Device { Device {
name, name,
os_name: System::name().unwrap_or_else(|| { os_name: sys.name().unwrap_or_else(|| {
warn!("Failed to get OS name. Saving as \"unknown\"."); warn!("Failed to get OS name. Saving as \"unknown\".");
"unknown".to_string() "unknown".to_string()
}), }),
os_version: System::os_version().unwrap_or_else(|| { os_version: sys.os_version().unwrap_or_else(|| {
warn!("Failed to get OS version. Saving as \"unknown\"."); warn!("Failed to get OS version. Saving as \"unknown\".");
"unknown".to_string() "unknown".to_string()
}), }),
hostname: System::host_name().unwrap_or_else(|| { hostname: sys.host_name().unwrap_or_else(|| {
warn!("Failed to get hostname. Saving as \"unknown\"."); warn!("Failed to get hostname. Saving as \"unknown\".");
"unknown".to_string() "unknown".to_string()
}), }),
@ -88,7 +89,6 @@ pub fn write_devices(config_dir: &Path, devices: Vec<Device>) -> Result<()> {
trace!("write_devices"); trace!("write_devices");
let f = OpenOptions::new() let f = OpenOptions::new()
.create(true) .create(true)
.truncate(true)
.write(true) .write(true)
.open(config_dir.join(DEVICESFILE))?; .open(config_dir.join(DEVICESFILE))?;
let writer = BufWriter::new(f); let writer = BufWriter::new(f);

View file

@ -17,7 +17,7 @@ impl FilePathCompleter {
return Ok(()); return Ok(());
} }
input.clone_into(&mut self.input); self.input = input.to_owned();
self.paths.clear(); self.paths.clear();
let input_path = std::path::PathBuf::from(input); let input_path = std::path::PathBuf::from(input);

View file

@ -2,7 +2,6 @@
use anyhow::{Context, Result}; use anyhow::{Context, Result};
use byte_unit::Byte; use byte_unit::Byte;
use byte_unit::UnitType;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::collections::BTreeMap; use std::collections::BTreeMap;
use std::fmt; use std::fmt;
@ -61,7 +60,10 @@ impl StorageExt for OnlineStorage {
self.local_infos.get(&device.name()) self.local_infos.get(&device.name())
} }
fn mount_path(&self, device: &devices::Device) -> Result<std::path::PathBuf> { fn mount_path(
&self,
device: &devices::Device,
) -> Result<std::path::PathBuf> {
Ok(self Ok(self
.local_infos .local_infos
.get(&device.name()) .get(&device.name())
@ -94,9 +96,9 @@ impl fmt::Display for OnlineStorage {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!( write!(
f, f,
"O {name:<10} {size:<10.2} {provider:<10}", "O {name:<10} {size:<10} {provider:<10}",
name = self.name(), name = self.name(),
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary), size = Byte::from_bytes(self.capacity.into()).get_appropriate_unit(true),
provider = self.provider, provider = self.provider,
) )
} }

View file

@ -4,11 +4,11 @@ use crate::devices;
use crate::devices::Device; use crate::devices::Device;
use crate::storages::{Storage, StorageExt, Storages}; use crate::storages::{Storage, StorageExt, Storages};
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use byte_unit::{Byte, UnitType}; use byte_unit::Byte;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::path::{self, Path}; use std::path::{self, Path};
use std::{collections::BTreeMap, fmt}; use std::{collections::BTreeMap, fmt};
use sysinfo::{Disk, Disks}; use sysinfo::{Disk, DiskExt, SystemExt};
use super::local_info::{self, LocalInfo}; use super::local_info::{self, LocalInfo};
@ -57,10 +57,7 @@ impl PhysicalDrivePartition {
.to_string(); .to_string();
let fs = disk.file_system(); let fs = disk.file_system();
trace!("fs: {:?}", fs); trace!("fs: {:?}", fs);
let fs: String = fs let fs = std::str::from_utf8(fs)?;
.to_str()
.context("Failed to convert file_system osstr")?
.to_owned();
let local_info = LocalInfo::new(alias, disk.mount_point().to_path_buf()); let local_info = LocalInfo::new(alias, disk.mount_point().to_path_buf());
Ok(PhysicalDrivePartition { Ok(PhysicalDrivePartition {
name, name,
@ -146,9 +143,9 @@ impl fmt::Display for PhysicalDrivePartition {
let removable_indicator = if self.is_removable { "+" } else { "-" }; let removable_indicator = if self.is_removable { "+" } else { "-" };
write!( write!(
f, f,
"P {name:<10} {size:<10.2} {removable:<1} {kind:<6} {fs:<5}", "P {name:<10} {size:<10} {removable:<1} {kind:<6} {fs:<5}",
name = self.name(), name = self.name(),
size = Byte::from_u64(self.capacity).get_appropriate_unit(UnitType::Binary), size = Byte::from_bytes(self.capacity.into()).get_appropriate_unit(true),
removable = removable_indicator, removable = removable_indicator,
kind = self.kind, kind = self.kind,
fs = self.fs, fs = self.fs,
@ -164,9 +161,13 @@ pub fn select_physical_storage(
) -> Result<PhysicalDrivePartition> { ) -> Result<PhysicalDrivePartition> {
trace!("select_physical_storage"); trace!("select_physical_storage");
// get disk info from sysinfo // get disk info from sysinfo
let sys_disks = Disks::new_with_refreshed_list(); let sys_disks =
sysinfo::System::new_with_specifics(sysinfo::RefreshKind::new().with_disks_list());
trace!("refresh");
// sys_disks.refresh_disks_list();
// sys_disks.refresh_disks();
trace!("Available disks"); trace!("Available disks");
for disk in &sys_disks { for disk in sys_disks.disks() {
trace!("{:?}", disk) trace!("{:?}", disk)
} }
let disk = select_sysinfo_disk(&sys_disks)?; let disk = select_sysinfo_disk(&sys_disks)?;
@ -174,19 +175,21 @@ pub fn select_physical_storage(
Ok(storage) Ok(storage)
} }
fn select_sysinfo_disk(disks: &sysinfo::Disks) -> Result<&Disk> { fn select_sysinfo_disk(sysinfo: &sysinfo::System) -> Result<&Disk> {
let available_disks = disks let available_disks = sysinfo
.disks()
.iter() .iter()
.enumerate() .enumerate()
.map(|(i, disk)| { .map(|(i, disk)| {
let name = disk.name().to_str().unwrap_or(""); let name = disk.name().to_str().unwrap_or("");
let fs: &str = disk.file_system().to_str().unwrap_or("unknown"); let fs: &str = std::str::from_utf8(disk.file_system()).unwrap_or("unknown");
let kind = format!("{:?}", disk.kind()); let kind = format!("{:?}", disk.kind());
let mount_path = disk.mount_point(); let mount_path = disk.mount_point();
let total_space = byte_unit::Byte::from_u64(disk.total_space()) let total_space = byte_unit::Byte::from_bytes(disk.total_space().into())
.get_appropriate_unit(UnitType::Binary); .get_appropriate_unit(true)
.to_string();
format!( format!(
"{}: {} {:>+5.1} ({}, {}) {}", "{}: {} {} ({}, {}) {}",
i, i,
name, name,
total_space, total_space,
@ -200,8 +203,10 @@ fn select_sysinfo_disk(disks: &sysinfo::Disks) -> Result<&Disk> {
let disk = inquire::Select::new("Select drive:", available_disks).prompt()?; let disk = inquire::Select::new("Select drive:", available_disks).prompt()?;
let disk_num: usize = disk.split(':').next().unwrap().parse().unwrap(); let disk_num: usize = disk.split(':').next().unwrap().parse().unwrap();
trace!("disk_num: {}", disk_num); trace!("disk_num: {}", disk_num);
let disk = disks let disk = sysinfo
.get(disk_num) .disks()
.iter()
.nth(disk_num)
.context("no disk matched with selected one.")?; .context("no disk matched with selected one.")?;
trace!("selected disk: {:?}", disk); trace!("selected disk: {:?}", disk);
Ok(disk) Ok(disk)