one point zero!

master
Avril 4 years ago
parent 1a23ce4c44
commit e6f2e85293
Signed by: flanchan
GPG Key ID: 284488987C31F630

78
Cargo.lock generated

@ -24,12 +24,6 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "arc-swap"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
[[package]] [[package]]
name = "atty" name = "atty"
version = "0.2.14" version = "0.2.14"
@ -342,35 +336,12 @@ dependencies = [
"kernel32-sys", "kernel32-sys",
"libc", "libc",
"log", "log",
"miow 0.2.1", "miow",
"net2", "net2",
"slab", "slab",
"winapi 0.2.8", "winapi 0.2.8",
] ]
[[package]]
name = "mio-named-pipes"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656"
dependencies = [
"log",
"mio",
"miow 0.3.5",
"winapi 0.3.9",
]
[[package]]
name = "mio-uds"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0"
dependencies = [
"iovec",
"libc",
"mio",
]
[[package]] [[package]]
name = "miow" name = "miow"
version = "0.2.1" version = "0.2.1"
@ -383,16 +354,6 @@ dependencies = [
"ws2_32-sys", "ws2_32-sys",
] ]
[[package]]
name = "miow"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e"
dependencies = [
"socket2",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "net2" name = "net2"
version = "0.2.35" version = "0.2.35"
@ -568,12 +529,6 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.3.9" version = "1.3.9"
@ -624,7 +579,7 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
[[package]] [[package]]
name = "sever" name = "sever"
version = "0.1.0" version = "1.0.0"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"color-eyre", "color-eyre",
@ -638,34 +593,12 @@ dependencies = [
"uuid", "uuid",
] ]
[[package]]
name = "signal-hook-registry"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a3e12110bc539e657a646068aaf5eb5b63af9d0c1f7b29c97113fad80e15f035"
dependencies = [
"arc-swap",
"libc",
]
[[package]] [[package]]
name = "slab" name = "slab"
version = "0.4.2" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
[[package]]
name = "socket2"
version = "0.3.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44"
dependencies = [
"cfg-if",
"libc",
"redox_syscall",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.42" version = "1.0.42"
@ -704,19 +637,12 @@ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
"futures-core", "futures-core",
"iovec",
"lazy_static", "lazy_static",
"libc",
"memchr", "memchr",
"mio", "mio",
"mio-named-pipes",
"mio-uds",
"num_cpus", "num_cpus",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry",
"slab",
"tokio-macros", "tokio-macros",
"winapi 0.3.9",
] ]
[[package]] [[package]]

@ -1,9 +1,11 @@
[package] [package]
name = "sever" name = "sever"
description = "Coerce hardlinks into new files" description = "Coerce hardlinks into new files"
version = "0.1.0" version = "1.0.0"
authors = ["Avril <flanchan@cumallover.me>"] authors = ["Avril <flanchan@cumallover.me>"]
edition = "2018" edition = "2018"
readme = "README.org"
license = "GPL-3.0-or-later"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@ -25,7 +27,7 @@ threads = ["parallel", "tokio/rt-threaded"]
[dependencies] [dependencies]
cfg-if = "0.1.10" cfg-if = "0.1.10"
tokio = {version = "0.2", features = ["full"], optional = true} tokio = {version = "0.2", features = ["rt-core", "rt-util", "io-driver", "fs", "macros", "sync", "stream"], optional = true}
log = "0.4.11" log = "0.4.11"
pretty_env_logger = "0.4.0" pretty_env_logger = "0.4.0"
color-eyre = {version = "0.5.6", default-features=false} color-eyre = {version = "0.5.6", default-features=false}

@ -0,0 +1,50 @@
* sever
Coerce hardlinks into new files
* Usage
Basic usage is simple:
#+BEGIN_SRC shell
$ sever file1 file2 file3 dir/*
#+END_SRC
** Logging
To change the verbosity level of output messages, set the ~RUST_LOG~ env var:
- trace: Most verbose. Show information about files as they're processed and redundant failures
- debug: Verbose. Show all errors and their causes
- info: The default level. Just show completions/failures
- warn: Just show warnings
- error: Just show errors
* Features
The ~sever~ binary has no flags. Instead, it comes with compile-time feature flags that can be enabled when building:
| Flag | Description | Default |
|-------------------+-----------------------------------------------------------------+---------|
| parallel | Process files in parallel | On |
| threads | Process files with a multi-threaded scheduler | Off |
| limit-concurrency | Apply a max limit (default 4096) of concurrent operation | On |
| recursive | Allow processing of directories by recursing through them | On |
| limit-recursion | Apply a max depth of recursion (default 256) | On |
| splash | Print program's compiled information when ran with no arguments | On |
** Building
To build with default features, run:
#+BEGIN_SRC shell
$ cargo build --release
$ strip target/release/sever
#+END_SRC
The binary will be built to ~target/release/sever~
*** Building with non-default features
To build with your desired features, run:
#+BEGIN_SRC shell
$ cargo build --release --no-default-features --features feature1,feature2,feature3,...
$ strip target/release/sever
#+END_SRC
The binary will be built to ~target/release/sever~
* License
GPL'd with <3

@ -1,4 +1,5 @@
#![allow(dead_code)] #![allow(dead_code)]
#![allow(unused_imports)]
#[macro_use] extern crate log; #[macro_use] extern crate log;
#[macro_use] mod macros; #[macro_use] mod macros;

@ -141,7 +141,7 @@ pub async fn main<I: Stream<Item=String>>(list: I) -> eyre::Result<()>
}, },
Ok(Err(k)) => { Ok(Err(k)) => {
failures.push((k.path().to_owned(), k.to_string())); failures.push((k.path().to_owned(), k.to_string()));
trace!("<{:?}> Failed (skipped)", k.path()); warn!("<{:?}> Failed (skipped)", k.path());
}, },
} }
done+=1; done+=1;

@ -41,7 +41,7 @@ impl fmt::Display for Recursion
match self { match self {
Self::N(n) => write!(f, "{}", n), Self::N(n) => write!(f, "{}", n),
Self::All => write!(f, "unlimited"), Self::All => write!(f, "unlimited"),
_ => write!(f, "no"), #[allow(unreachable_patterns)] _ => write!(f, "no"),
} }
} }
} }

@ -64,9 +64,21 @@ pub fn main<I: IntoIterator<Item=String>>(list: I) -> eyre::Result<()>
match work(file) { match work(file) {
Ok((path, true)) => info!("<{:?}> OK (processed)", path), Ok((path, true)) => info!("<{:?}> OK (processed)", path),
Ok((path, false)) => info!("<{:?}> OK (skipped)", path), Ok((path, false)) => info!("<{:?}> OK (skipped)", path),
Err(kind) if !kind.kind().is_skippable() => {
failures.push((kind.path().to_owned(), kind.to_string()));
let fuck = format!("{:?}", kind.path());
let sug = kind.kind().suggestion();
let err = Err::<std::convert::Infallible, _>(kind)
.wrap_err_with(|| eyre!("<{}> Failed", fuck))
.with_section(move || fuck.header("Path was"))
.with_suggestion(|| sug)
.unwrap_err();
error!("{}", err);
debug!("Error: {:?}", err);
},
Err(k) => { Err(k) => {
failures.push((k.path().to_owned(), k.to_string())); failures.push((k.path().to_owned(), k.to_string()));
trace!("<{:?}> Failed (skipped)", k.path()); warn!("<{:?}> Failed (skipped)", k.path());
}, },
} }
done+=1; done+=1;

Loading…
Cancel
Save