diff --git a/Cargo.lock b/Cargo.lock index 1a9af91..0114ffb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -591,6 +591,7 @@ dependencies = [ "anstyle", "clap_lex", "strsim", + "terminal_size", ] [[package]] @@ -772,6 +773,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + [[package]] name = "fastrand" version = "2.1.1" @@ -1095,6 +1106,12 @@ version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + [[package]] name = "lock_api" version = "0.4.12" @@ -1446,6 +1463,19 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + [[package]] name = "rustls" version = "0.21.12" @@ -1715,6 +1745,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "terminal_size" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +dependencies = [ + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "thread_local" version = "1.1.8" diff --git a/Cargo.toml b/Cargo.toml index de3d48b..7665547 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ license = "Apache-2.0" anyhow = "1.0.89" aws-config = "1.5.8" aws-sdk-s3 = { version = "1.55.0", features = ["http-1x"] } -clap = { version = "4.5.20", features = ["derive"] } +clap = { version = "4.5.20", features = ["derive", "wrap_help"] } http-body = "1.0.1" http-body-util = "0.1.2" serde = { version = "1.0.210", features = ["derive"] } diff --git a/src/consts.rs b/src/consts.rs index 2654bba..6dfa869 100644 --- a/src/consts.rs +++ b/src/consts.rs @@ -42,16 +42,14 @@ pub(crate) const MINIMUM_PART_NUMBER: u64 = 1; /// Source: https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html pub(crate) const MAXIMUM_PART_NUMBER: u64 = 10_000; -/// Part size: 5 MiB to 5 GiB. +/// Minimum part size: 5 MiB /// /// There is no minimum size limit on the last part of your multipart upload. /// /// Source: https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html pub(crate) const MINIMUM_PART_SIZE: u64 = 5 * MiB; -/// Part size: 5 MiB to 5 GiB. -/// -/// There is no minimum size limit on the last part of your multipart upload. +/// Maximum part size: 5 GiB /// /// Source: https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html pub(crate) const MAXIMUM_PART_SIZE: u64 = 5 * GiB; diff --git a/src/main.rs b/src/main.rs index fc4fb70..d0ce860 100644 --- a/src/main.rs +++ b/src/main.rs @@ -124,6 +124,15 @@ impl State { } } +/// With Persevere you can upload huge files to S3 without worrying about network interruptions or +/// other issues. Persevere will allow you to resume the upload where it was left off, even in the +/// case of a system crash during upload. +/// +/// The contents of the file you upload are always streamed, which means the memory usage of +/// Persevere is minimal, usually below 10 MB. This makes it possible to upload files of any size +/// supported by S3, even if they are larger than the available memory of your system. +/// +/// Source: #[derive(Debug, Parser)] #[command(version)] enum Cli { @@ -141,6 +150,11 @@ enum Cli { /// /// * `s3:PutObject` /// * `s3:AbortMultipartUpload` + /// + /// Persevere will automatically discover valid AWS credentials like most AWS SDKs. This means + /// you can provide environment variables such as `AWS_PROFILE` to select the profile you want + /// to upload a file with, or provide the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` + /// directly. Upload(Upload), /// Resume the upload of a file to S3. /// @@ -156,6 +170,11 @@ enum Cli { /// /// * `s3:PutObject` /// * `s3:AbortMultipartUpload` + /// + /// Persevere will automatically discover valid AWS credentials like most AWS SDKs. This means + /// you can provide environment variables such as `AWS_PROFILE` to select the profile you want + /// to upload a file with, or provide the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` + /// directly. Resume(Resume), /// Abort the upload of a file to S3. /// @@ -168,6 +187,11 @@ enum Cli { /// /// * `s3:PutObject` /// * `s3:AbortMultipartUpload` + /// + /// Persevere will automatically discover valid AWS credentials like most AWS SDKs. This means + /// you can provide environment variables such as `AWS_PROFILE` to select the profile you want + /// to upload a file with, or provide the `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` + /// directly. Abort(Abort), }