mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-31 13:07:46 +00:00
pwd: update to clap 4
This commit is contained in:
parent
62b963a353
commit
9dc9e44cd5
2 changed files with 8 additions and 5 deletions
|
@ -15,7 +15,7 @@ edition = "2021"
|
|||
path = "src/pwd.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" }
|
||||
|
||||
[[bin]]
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
// * For the full copyright and license information, please view the LICENSE
|
||||
// * file that was distributed with this source code.
|
||||
|
||||
use clap::ArgAction;
|
||||
use clap::{crate_version, Arg, Command};
|
||||
use std::env;
|
||||
use std::io;
|
||||
|
@ -125,7 +126,7 @@ fn logical_path() -> io::Result<PathBuf> {
|
|||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let matches = uu_app().try_get_matches_from(args)?;
|
||||
let cwd = if matches.contains_id(OPT_LOGICAL) {
|
||||
let cwd = if matches.get_flag(OPT_LOGICAL) {
|
||||
logical_path()
|
||||
} else {
|
||||
physical_path()
|
||||
|
@ -148,7 +149,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)
|
||||
|
@ -158,13 +159,15 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(OPT_LOGICAL)
|
||||
.short('L')
|
||||
.long(OPT_LOGICAL)
|
||||
.help("use PWD from environment, even if it contains symlinks"),
|
||||
.help("use PWD from environment, even if it contains symlinks")
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
.arg(
|
||||
Arg::new(OPT_PHYSICAL)
|
||||
.short('P')
|
||||
.long(OPT_PHYSICAL)
|
||||
.overrides_with(OPT_LOGICAL)
|
||||
.help("avoid all symlinks"),
|
||||
.help("avoid all symlinks")
|
||||
.action(ArgAction::SetTrue),
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue