mirror of
https://git.sr.ht/~nixgoat/vento
synced 2024-11-21 14:23:05 +00:00
Compare commits
2 commits
52a830331c
...
bb02a070f9
Author | SHA1 | Date | |
---|---|---|---|
Lux Aliaga | bb02a070f9 | ||
Lux Aliaga | a841ba974c |
215
Cargo.lock
generated
215
Cargo.lock
generated
|
@ -13,6 +13,55 @@ dependencies = [
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is-terminal",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.65"
|
version = "1.0.65"
|
||||||
|
@ -27,7 +76,7 @@ checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -36,7 +85,7 @@ version = "0.2.14"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"hermit-abi",
|
"hermit-abi 0.1.19",
|
||||||
"libc",
|
"libc",
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
@ -59,6 +108,12 @@ version = "1.3.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "bitflags"
|
||||||
|
version = "2.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "block-buffer"
|
name = "block-buffer"
|
||||||
version = "0.10.3"
|
version = "0.10.3"
|
||||||
|
@ -80,6 +135,53 @@ 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 = "clap"
|
||||||
|
version = "4.3.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3"
|
||||||
|
dependencies = [
|
||||||
|
"clap_builder",
|
||||||
|
"clap_derive",
|
||||||
|
"once_cell",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_builder"
|
||||||
|
version = "4.3.23"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"clap_lex",
|
||||||
|
"strsim",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_derive"
|
||||||
|
version = "4.3.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
|
||||||
|
dependencies = [
|
||||||
|
"heck",
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"syn 2.0.29",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "clap_lex"
|
||||||
|
version = "0.5.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colored"
|
name = "colored"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
|
@ -166,6 +268,27 @@ version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
|
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f"
|
||||||
|
dependencies = [
|
||||||
|
"errno-dragonfly",
|
||||||
|
"libc",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "errno-dragonfly"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||||
|
dependencies = [
|
||||||
|
"cc",
|
||||||
|
"libc",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filetime"
|
name = "filetime"
|
||||||
version = "0.2.20"
|
version = "0.2.20"
|
||||||
|
@ -223,6 +346,12 @@ dependencies = [
|
||||||
"ahash",
|
"ahash",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "heck"
|
||||||
|
version = "0.4.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hermit-abi"
|
name = "hermit-abi"
|
||||||
version = "0.1.19"
|
version = "0.1.19"
|
||||||
|
@ -232,6 +361,23 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "hermit-abi"
|
||||||
|
version = "0.3.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is-terminal"
|
||||||
|
version = "0.4.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b"
|
||||||
|
dependencies = [
|
||||||
|
"hermit-abi 0.3.2",
|
||||||
|
"rustix",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
|
@ -257,9 +403,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.132"
|
version = "0.2.147"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
|
checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
|
@ -267,6 +413,12 @@ version = "0.5.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "linux-raw-sys"
|
||||||
|
version = "0.4.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lzma-sys"
|
name = "lzma-sys"
|
||||||
version = "0.1.20"
|
version = "0.1.20"
|
||||||
|
@ -431,7 +583,7 @@ dependencies = [
|
||||||
"pest_meta",
|
"pest_meta",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -453,18 +605,18 @@ checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "1.0.43"
|
version = "1.0.66"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab"
|
checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.21"
|
version = "1.0.33"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
|
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
]
|
]
|
||||||
|
@ -475,7 +627,7 @@ version = "0.2.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags 1.3.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -502,7 +654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
|
checksum = "88073939a61e5b7680558e6be56b419e208420c2adb92be54921fa6b72283f1a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"bitflags",
|
"bitflags 1.3.2",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -516,6 +668,19 @@ dependencies = [
|
||||||
"ordered-multimap",
|
"ordered-multimap",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustix"
|
||||||
|
version = "0.38.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 2.4.0",
|
||||||
|
"errno",
|
||||||
|
"libc",
|
||||||
|
"linux-raw-sys",
|
||||||
|
"windows-sys 0.48.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.11"
|
version = "1.0.11"
|
||||||
|
@ -539,7 +704,7 @@ checksum = "81fa1584d3d1bcacd84c277a0dfe21f5b0f6accf4a23d04d4c6d61f1af522b4c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -574,6 +739,12 @@ dependencies = [
|
||||||
"num",
|
"num",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "strsim"
|
||||||
|
version = "0.10.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.99"
|
version = "1.0.99"
|
||||||
|
@ -585,6 +756,17 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "syn"
|
||||||
|
version = "2.0.29"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2",
|
||||||
|
"quote",
|
||||||
|
"unicode-ident",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tar"
|
name = "tar"
|
||||||
version = "0.4.38"
|
version = "0.4.38"
|
||||||
|
@ -613,7 +795,7 @@ checksum = "e8f2591983642de85c921015f3f070c665a197ed69e417af436115e3a1407487"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn 1.0.99",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -643,11 +825,18 @@ version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
|
checksum = "c4f5b37a154999a8f3f98cc23a628d850e154479cd94decf3414696e12e31aaf"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "vento"
|
name = "vento"
|
||||||
version = "1.3.0-alpha"
|
version = "1.3.0-alpha"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
"clap",
|
||||||
"colored",
|
"colored",
|
||||||
"config",
|
"config",
|
||||||
"dirs",
|
"dirs",
|
||||||
|
|
|
@ -24,6 +24,7 @@ size_format = "1.0.2"
|
||||||
config = "0.13"
|
config = "0.13"
|
||||||
xz2 = "0.1"
|
xz2 = "0.1"
|
||||||
tar = "0.4"
|
tar = "0.4"
|
||||||
|
clap = { version = "4.3.23", features = ["derive"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
man = "0.3.0"
|
man = "0.3.0"
|
||||||
|
|
|
@ -18,63 +18,33 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::env;
|
use clap::Parser;
|
||||||
use std::path::Path;
|
use std::path::PathBuf;
|
||||||
use vento::{
|
use vento::{common::get_current_dir, item};
|
||||||
common::get_current_dir,
|
|
||||||
common::override_color,
|
#[derive(Parser)]
|
||||||
help, item,
|
#[command(name = "Drop")]
|
||||||
message::{throw_error, ErrorType},
|
#[command(about = "A file dropper for Vento", long_about = None)]
|
||||||
};
|
#[command(author, version)]
|
||||||
|
struct Cli {
|
||||||
|
/// Pick a slot to drop the file from
|
||||||
|
#[arg(short, long)]
|
||||||
|
slot: Option<String>,
|
||||||
|
|
||||||
|
/// File to drop from inventory
|
||||||
|
file: String,
|
||||||
|
/// Location to drop file onto
|
||||||
|
output: Option<PathBuf>,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
// Handles args in Drop
|
// Handles args in Drop
|
||||||
override_color()?;
|
let cli = Cli::parse();
|
||||||
let args: Vec<String> = env::args().collect();
|
let unwrapped_slot = cli.slot.unwrap_or(String::from("active"));
|
||||||
if args.len() >= 2 {
|
let slot = unwrapped_slot.as_str();
|
||||||
if args[1].contains("--slot=") {
|
let out = cli.output.unwrap_or(get_current_dir()?);
|
||||||
// Checks if the user has provided the long argument "--slot="
|
|
||||||
match args.len() {
|
item::drop(&cli.file, slot, out, true)?;
|
||||||
4 => item::drop(
|
|
||||||
&args[2],
|
|
||||||
&args[1].as_str().replace("--slot=", ""),
|
|
||||||
Path::new(&args[4]).to_path_buf(),
|
|
||||||
true,
|
|
||||||
)?,
|
|
||||||
3 => item::drop(
|
|
||||||
&args[2],
|
|
||||||
&args[1].as_str().replace("--slot=", ""),
|
|
||||||
get_current_dir()?,
|
|
||||||
true,
|
|
||||||
)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
match args[1].as_str() {
|
|
||||||
"--help" | "-h" => help::drop()?,
|
|
||||||
"-s" => match args.len() {
|
|
||||||
5 => item::drop(&args[3], &args[2], Path::new(&args[4]).to_path_buf(), true)?,
|
|
||||||
4 => item::drop(&args[3], &args[2], get_current_dir()?, true)?,
|
|
||||||
3 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifySlot)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
_ => match args.len() {
|
|
||||||
3 => item::drop(
|
|
||||||
&args[1],
|
|
||||||
&String::from("active"),
|
|
||||||
Path::new(&args[2]).to_path_buf(),
|
|
||||||
true,
|
|
||||||
)?,
|
|
||||||
2 => item::drop(&args[1], &String::from("active"), get_current_dir()?, true)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If the user provides no arguments, Drop will display the help message.
|
|
||||||
help::drop()?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,43 +18,28 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::env;
|
use clap::Parser;
|
||||||
use vento::{
|
use vento::{common::override_color, item};
|
||||||
common::override_color,
|
|
||||||
help, item,
|
#[derive(Parser)]
|
||||||
message::{throw_error, ErrorType},
|
#[command(name = "Take")]
|
||||||
};
|
#[command(about = "A file grabber for Vento", long_about = None)]
|
||||||
|
#[command(author, version)]
|
||||||
|
struct Cli {
|
||||||
|
/// Pick a slot to take the file into
|
||||||
|
#[arg(short, long)]
|
||||||
|
slot: Option<String>,
|
||||||
|
|
||||||
|
/// File to take
|
||||||
|
file: String,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
// Handles args in Vento
|
// Handles args in Vento
|
||||||
override_color()?;
|
override_color()?;
|
||||||
let args: Vec<String> = env::args().collect();
|
let cli = Cli::parse();
|
||||||
if args.len() >= 2 {
|
let slot = cli.slot.unwrap_or(String::from("active"));
|
||||||
if args[1].contains("--slot=") {
|
|
||||||
// Checks if the user has provided the long argument "--slot="
|
item::take(&cli.file, &slot, true)?;
|
||||||
match args.len() {
|
|
||||||
3 => item::take(&args[2], &args[1].replace("--slot=", ""), true)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
match args[1].as_str() {
|
|
||||||
"--help" | "-h" => help::take()?,
|
|
||||||
"-s" => match args.len() {
|
|
||||||
4 => item::take(&args[3], &args[2], true)?,
|
|
||||||
3 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifySlot)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
_ => match args.len() {
|
|
||||||
2 => item::take(&args[1], &String::from("active"), true)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// If the user provides no arguments, Take will display the help message.
|
|
||||||
help::take()?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
154
src/bin/vento.rs
154
src/bin/vento.rs
|
@ -18,78 +18,110 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::{env, path::PathBuf};
|
use clap::Parser;
|
||||||
|
use std::path::PathBuf;
|
||||||
use vento::{
|
use vento::{
|
||||||
archive,
|
archive,
|
||||||
common::override_color,
|
common::override_color,
|
||||||
help, history, inv,
|
history, inv,
|
||||||
message::{throw_error, ErrorType},
|
message::{throw_error, ErrorType},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[derive(Parser)]
|
||||||
|
#[command(name = "Vento")]
|
||||||
|
#[command(author, version, about, long_about = None)]
|
||||||
|
struct Cli {
|
||||||
|
/// Pick slot to list
|
||||||
|
#[arg(short, long)]
|
||||||
|
slot: Option<String>,
|
||||||
|
|
||||||
|
/// Switch slots
|
||||||
|
#[arg(short = 'c', long)]
|
||||||
|
switch: bool,
|
||||||
|
|
||||||
|
/// Undo the last action
|
||||||
|
#[arg(short, long)]
|
||||||
|
undo: bool,
|
||||||
|
|
||||||
|
/// Export an inventory
|
||||||
|
#[arg(short, long, value_names = &["SLOT", "ARCHIVE"], num_args = ..=2)]
|
||||||
|
export_inv: Option<Vec<String>>,
|
||||||
|
|
||||||
|
/// Export the Vento directory
|
||||||
|
#[arg(short = 'E', long, default_missing_value = "vento.tar.xz", value_name = "ARCHIVE", num_args = ..=1)]
|
||||||
|
export_dir: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// Import an inventory archive
|
||||||
|
#[arg(short = 'g', long, num_args = 1..=2, value_names = &["ARCHIVE", "SLOT"])]
|
||||||
|
import_inv: Option<Vec<String>>,
|
||||||
|
|
||||||
|
/// Import a Vento directory archive
|
||||||
|
#[arg(short = 'G', long, value_name = "ARCHIVE")]
|
||||||
|
import_dir: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// Initialize Vento
|
||||||
|
#[arg(short, long)]
|
||||||
|
init: bool,
|
||||||
|
|
||||||
|
directory: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
// Handles args in Vento
|
|
||||||
override_color()?;
|
override_color()?;
|
||||||
let args: Vec<String> = env::args().collect();
|
let cli = Cli::parse();
|
||||||
if args.len() >= 2 {
|
let unwrapped_dir = cli.directory.unwrap_or(String::new());
|
||||||
// If the vector for the arguments the command is taking is larger than 2, it most likely means the user has provided an argument
|
let dir = unwrapped_dir.as_str();
|
||||||
if args[1].contains("--slot=") {
|
|
||||||
// Checks if the user has provided the long argument "--slot="
|
if cli.switch {
|
||||||
match args.len() {
|
inv::switch(true)?
|
||||||
3 => inv::list(&args[1].replace("--slot=", ""), &args[2])?,
|
} else if cli.undo {
|
||||||
2 => inv::list(&args[1].replace("--slot=", ""), "")?,
|
history::undo()?
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
} else if cli.init {
|
||||||
};
|
inv::init()?
|
||||||
} else {
|
} else if cli.export_inv.is_some() {
|
||||||
match args[1].as_str() {
|
let unwrapped_export_inv = cli.export_inv.unwrap();
|
||||||
"-h" | "--help" => help::vento()?,
|
let export_inv_values = match unwrapped_export_inv.len() {
|
||||||
"-i" | "--init" => inv::init()?,
|
0 => vec![String::from("active"), String::from("active.tar.xz")],
|
||||||
"-c" | "--switch" => inv::switch(true)?,
|
_ => unwrapped_export_inv,
|
||||||
"-u" | "--undo" => history::undo()?,
|
};
|
||||||
"-e" | "--export-inv" => match args.len() {
|
|
||||||
4 => archive::export_inv(&args[2], PathBuf::from(&args[3]), true)?,
|
archive::export_inv(
|
||||||
3 => match args[2].as_str() {
|
match export_inv_values[0].as_str() {
|
||||||
"active" | "a" | "inactive" | "i" => {
|
"active" | "inactive" | "a" | "i" => export_inv_values[0].as_str(),
|
||||||
let mut path = PathBuf::from(match args[2].as_str() {
|
_ => "active",
|
||||||
"a" => "active",
|
},
|
||||||
"i" => "inactive",
|
PathBuf::from(match export_inv_values[0].as_str() {
|
||||||
_ => &args[2],
|
"active" | "inactive" | "a" | "i" => export_inv_values[1].as_str(),
|
||||||
});
|
_ => export_inv_values[0].as_str(),
|
||||||
path.set_extension("tar.xz");
|
}),
|
||||||
archive::export_inv(&args[2], path, true)?
|
true,
|
||||||
}
|
)?
|
||||||
_ => archive::export_inv("active", PathBuf::from(&args[2]), true)?,
|
} else if cli.export_dir.is_some() {
|
||||||
|
archive::export_dir(cli.export_dir.unwrap(), true)?
|
||||||
|
} else if cli.import_inv.is_some() {
|
||||||
|
let import_inv_values = &cli
|
||||||
|
.import_inv
|
||||||
|
.unwrap_or(vec![String::new(), String::from("active")]);
|
||||||
|
|
||||||
|
match import_inv_values[0].as_str() {
|
||||||
|
"" | "active" | "inactive" | "a" | "i" => throw_error(ErrorType::SpecifyFile)?,
|
||||||
|
_ => archive::import_inv(
|
||||||
|
PathBuf::from(&import_inv_values[0]),
|
||||||
|
match import_inv_values.len() {
|
||||||
|
2 => match import_inv_values[1].as_str() {
|
||||||
|
"active" | "inactive" | "a" | "i" => import_inv_values[1].as_str(),
|
||||||
|
_ => "active",
|
||||||
},
|
},
|
||||||
2 => archive::export_inv("active", PathBuf::from("active.tar.xz"), true)?,
|
_ => "active",
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
},
|
||||||
"-E" | "--export-dir" => match args.len() {
|
true,
|
||||||
3 => archive::export_dir(PathBuf::from(&args[2]), true)?,
|
)?,
|
||||||
2 => archive::export_dir(PathBuf::from("vento.tar.xz"), true)?,
|
};
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
} else if cli.import_dir.is_some() {
|
||||||
},
|
archive::import_dir(cli.import_dir.unwrap(), true)?
|
||||||
"-g" | "--import-inv" => match args.len() {
|
|
||||||
4 => archive::import_inv(PathBuf::from(&args[2]), &args[3], true)?,
|
|
||||||
3 => archive::import_inv(PathBuf::from(&args[2]), "active", true)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
"-G" | "--import-dir" => match args.len() {
|
|
||||||
3 => archive::import_dir(PathBuf::from(&args[2]), true)?,
|
|
||||||
2 => throw_error(ErrorType::SpecifyFile)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
"-s" => match args.len() {
|
|
||||||
4 => inv::list(&args[2], &args[3])?,
|
|
||||||
3 => inv::list(&args[2], "")?,
|
|
||||||
2 => throw_error(ErrorType::SpecifySlot)?,
|
|
||||||
_ => throw_error(ErrorType::TooManyArgs)?,
|
|
||||||
},
|
|
||||||
_ => inv::list("active", args[1].as_str())?,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// If the user provides no arguments, Vento will display the files in the active slot.
|
inv::list(cli.slot.unwrap_or(String::from("active")).as_str(), dir)?
|
||||||
inv::list("active", "")?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
96
src/help.rs
96
src/help.rs
|
@ -1,96 +0,0 @@
|
||||||
/*
|
|
||||||
* Vento, a CLI inventory for your files.
|
|
||||||
* Copyright (C) 2022 Lux Aliaga
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
use anyhow::Result;
|
|
||||||
use colored::Colorize;
|
|
||||||
|
|
||||||
/// Displays the help message for the vento command
|
|
||||||
pub fn vento() -> Result<()> {
|
|
||||||
println!(
|
|
||||||
"{}, a CLI inventory for your files
|
|
||||||
© 2022-2023 Lux Aliaga. Licensed under GPLv3
|
|
||||||
|
|
||||||
{}
|
|
||||||
- {}: Lists files in selected inventory
|
|
||||||
- {}: Switches slots
|
|
||||||
- {}: Undoes the last action
|
|
||||||
- {}: Exports an inventory
|
|
||||||
- {}: Exports the Vento directory
|
|
||||||
- {}: Imports an inventory archive
|
|
||||||
- {}: Imports a Vento directory archive
|
|
||||||
- {}: Initializes Vento
|
|
||||||
- {}: Displays this message",
|
|
||||||
"Vento".bold().blue(),
|
|
||||||
"Usage:".bold(),
|
|
||||||
"vento [ -s slot | --slot=slot ] [ directory ]"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
"vento ( -c | --switch )".bold().green(),
|
|
||||||
"vento ( -u | --undo )".bold().green(),
|
|
||||||
"vento ( -e | --export-inv ) [ slot ] [ output ]"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
"vento ( -E | --export-dir ) [ output ]".bold().green(),
|
|
||||||
"vento ( -g | --import-inv ) [ input ] [ slot ]"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
"vento ( -G | --import-dir ) [ input ]".bold().green(),
|
|
||||||
"vento ( -i | --init )".bold().green(),
|
|
||||||
"vento ( -h | --help )".bold().green()
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Displays the help message for the take command
|
|
||||||
pub fn take() -> Result<()> {
|
|
||||||
println!(
|
|
||||||
"{}, a file grabber for Vento
|
|
||||||
© 2022-2023 Lux Aliaga. Licensed under GPLv3
|
|
||||||
|
|
||||||
{}
|
|
||||||
- {}: Takes a file and saves it in the inventory
|
|
||||||
- {}: Displays this message",
|
|
||||||
"Take".bold().blue(),
|
|
||||||
"Usage:".bold(),
|
|
||||||
"take [ -s slot | --slot=slot ] file | directory"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
"take ( -h | --help )".bold().green()
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Displays the help message for the drop command
|
|
||||||
pub fn drop() -> Result<()> {
|
|
||||||
println!(
|
|
||||||
"{}, a file dropper for Vento
|
|
||||||
© 2022-2023 Lux Aliaga. Licensed under GPLv3
|
|
||||||
|
|
||||||
{}
|
|
||||||
- {}: Takes a file off the inventory and drops it
|
|
||||||
- {}: Displays this message",
|
|
||||||
"Drop".bold().blue(),
|
|
||||||
"Usage:".bold(),
|
|
||||||
"drop [ -s slot | --slot=slot ] file | directory [destination]"
|
|
||||||
.bold()
|
|
||||||
.green(),
|
|
||||||
"drop ( -h | --help )".bold().green()
|
|
||||||
);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
pub mod archive;
|
pub mod archive;
|
||||||
pub mod common;
|
pub mod common;
|
||||||
pub mod help;
|
|
||||||
pub mod history;
|
pub mod history;
|
||||||
pub mod inv;
|
pub mod inv;
|
||||||
pub mod item;
|
pub mod item;
|
||||||
|
|
Loading…
Reference in a new issue