mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +00:00
shred: clap 3
This commit is contained in:
parent
41513a8ba6
commit
92e94de2d7
2 changed files with 22 additions and 18 deletions
|
@ -15,7 +15,7 @@ edition = "2018"
|
||||||
path = "src/shred.rs"
|
path = "src/shred.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "2.33", features = ["wrap_help"] }
|
clap = { version = "3.0", features = ["wrap_help", "cargo"] }
|
||||||
libc = "0.2.42"
|
libc = "0.2.42"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
uucore = { version=">=0.0.10", package="uucore", path="../../uucore" }
|
||||||
|
|
|
@ -275,7 +275,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
|
|
||||||
let usage = usage();
|
let usage = usage();
|
||||||
|
|
||||||
let app = uu_app().usage(&usage[..]);
|
let app = uu_app().override_usage(&usage[..]);
|
||||||
|
|
||||||
let matches = app.get_matches_from(args);
|
let matches = app.get_matches_from(args);
|
||||||
|
|
||||||
|
@ -321,62 +321,66 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn uu_app() -> App<'static, 'static> {
|
pub fn uu_app<'a>() -> App<'a> {
|
||||||
App::new(uucore::util_name())
|
App::new(uucore::util_name())
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.about(ABOUT)
|
.about(ABOUT)
|
||||||
.after_help(AFTER_HELP)
|
.after_help(AFTER_HELP)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::FORCE)
|
Arg::new(options::FORCE)
|
||||||
.long(options::FORCE)
|
.long(options::FORCE)
|
||||||
.short("f")
|
.short('f')
|
||||||
.help("change permissions to allow writing if necessary"),
|
.help("change permissions to allow writing if necessary"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::ITERATIONS)
|
Arg::new(options::ITERATIONS)
|
||||||
.long(options::ITERATIONS)
|
.long(options::ITERATIONS)
|
||||||
.short("n")
|
.short('n')
|
||||||
.help("overwrite N times instead of the default (3)")
|
.help("overwrite N times instead of the default (3)")
|
||||||
.value_name("NUMBER")
|
.value_name("NUMBER")
|
||||||
.default_value("3"),
|
.default_value("3"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::SIZE)
|
Arg::new(options::SIZE)
|
||||||
.long(options::SIZE)
|
.long(options::SIZE)
|
||||||
.short("s")
|
.short('s')
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("N")
|
.value_name("N")
|
||||||
.help("shred this many bytes (suffixes like K, M, G accepted)"),
|
.help("shred this many bytes (suffixes like K, M, G accepted)"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::REMOVE)
|
Arg::new(options::REMOVE)
|
||||||
.short("u")
|
.short('u')
|
||||||
.long(options::REMOVE)
|
.long(options::REMOVE)
|
||||||
.help("truncate and remove file after overwriting; See below"),
|
.help("truncate and remove file after overwriting; See below"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::VERBOSE)
|
Arg::new(options::VERBOSE)
|
||||||
.long(options::VERBOSE)
|
.long(options::VERBOSE)
|
||||||
.short("v")
|
.short('v')
|
||||||
.help("show progress"),
|
.help("show progress"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::EXACT)
|
Arg::new(options::EXACT)
|
||||||
.long(options::EXACT)
|
.long(options::EXACT)
|
||||||
.short("x")
|
.short('x')
|
||||||
.help(
|
.help(
|
||||||
"do not round file sizes up to the next full block;\n\
|
"do not round file sizes up to the next full block;\n\
|
||||||
this is the default for non-regular files",
|
this is the default for non-regular files",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::ZERO)
|
Arg::new(options::ZERO)
|
||||||
.long(options::ZERO)
|
.long(options::ZERO)
|
||||||
.short("z")
|
.short('z')
|
||||||
.help("add a final overwrite with zeros to hide shredding"),
|
.help("add a final overwrite with zeros to hide shredding"),
|
||||||
)
|
)
|
||||||
// Positional arguments
|
// Positional arguments
|
||||||
.arg(Arg::with_name(options::FILE).hidden(true).multiple(true))
|
.arg(
|
||||||
|
Arg::new(options::FILE)
|
||||||
|
.hide(true)
|
||||||
|
.multiple_occurrences(true),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Add support for all postfixes here up to and including EiB
|
// TODO: Add support for all postfixes here up to and including EiB
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue