mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
chroot: update to clap 4
This commit is contained in:
parent
c6aabd9023
commit
a6816c1613
2 changed files with 7 additions and 6 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
|||
path = "src/chroot.rs"
|
||||
|
||||
[dependencies]
|
||||
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
|
||||
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
|
||||
uucore = { version=">=0.0.16", package="uucore", path="../../uucore", features=["entries", "fs"] }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
mod error;
|
||||
|
||||
use crate::error::ChrootError;
|
||||
use clap::{crate_version, Arg, Command};
|
||||
use clap::{crate_version, Arg, ArgAction, Command};
|
||||
use std::ffi::CString;
|
||||
use std::io::Error;
|
||||
use std::os::unix::prelude::OsStrExt;
|
||||
|
@ -49,7 +49,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
None => return Err(ChrootError::MissingNewRoot.into()),
|
||||
};
|
||||
|
||||
let skip_chdir = matches.contains_id(options::SKIP_CHDIR);
|
||||
let skip_chdir = matches.get_flag(options::SKIP_CHDIR);
|
||||
// We are resolving the path in case it is a symlink or /. or /../
|
||||
if skip_chdir
|
||||
&& canonicalize(newroot, MissingHandling::Normal, ResolveMode::Logical)
|
||||
|
@ -116,7 +116,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
pub fn uu_app<'a>() -> Command<'a> {
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
|
@ -168,13 +168,14 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
"Use this option to not change the working directory \
|
||||
to / after changing the root directory to newroot, \
|
||||
i.e., inside the chroot.",
|
||||
),
|
||||
)
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(options::COMMAND)
|
||||
.action(ArgAction::Append)
|
||||
.value_hint(clap::ValueHint::CommandName)
|
||||
.hide(true)
|
||||
.multiple_occurrences(true)
|
||||
.index(2),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue