From 8349d5cf6ade0d0a4cba63cb235313c358829b67 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 26 Jan 2024 20:22:10 +0100 Subject: [PATCH] pwdx is part of procps - moved https://github.com/uutils/procps --- Cargo.lock | 9 ------- Cargo.toml | 2 -- src/uu/pwdx/Cargo.toml | 17 ------------- src/uu/pwdx/pwdx.md | 7 ----- src/uu/pwdx/src/main.rs | 1 - src/uu/pwdx/src/pwdx.rs | 52 -------------------------------------- tests/by-util/test_pwdx.rs | 14 ---------- tests/tests.rs | 4 --- 8 files changed, 106 deletions(-) delete mode 100644 src/uu/pwdx/Cargo.toml delete mode 100644 src/uu/pwdx/pwdx.md delete mode 100644 src/uu/pwdx/src/main.rs delete mode 100644 src/uu/pwdx/src/pwdx.rs delete mode 100644 tests/by-util/test_pwdx.rs diff --git a/Cargo.lock b/Cargo.lock index 8ee4a2a..4d732cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -640,7 +640,6 @@ dependencies = [ "textwrap", "uu_lscpu", "uu_mountpoint", - "uu_pwdx", "uu_renice", "uucore", "xattr", @@ -664,14 +663,6 @@ dependencies = [ "uucore", ] -[[package]] -name = "uu_pwdx" -version = "0.0.1" -dependencies = [ - "clap", - "uucore", -] - [[package]] name = "uu_renice" version = "0.0.1" diff --git a/Cargo.toml b/Cargo.toml index d665dc5..f0f892f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ build = "build.rs" default = ["feat_common_core"] feat_common_core = [ - "pwdx", "renice", "mountpoint", "lscpu", @@ -56,7 +55,6 @@ textwrap = { workspace = true } # -pwdx = { optional = true, version = "0.0.1", package = "uu_pwdx", path = "src/uu/pwdx" } lscpu = { optional = true, version = "0.0.1", package = "uu_lscpu", path = "src/uu/lscpu" } renice = { optional = true, version = "0.0.1", package = "uu_renice", path = "src/uu/renice" } mountpoint = { optional = true, version = "0.0.1", package = "uu_mountpoint", path = "src/uu/mountpoint" } diff --git a/src/uu/pwdx/Cargo.toml b/src/uu/pwdx/Cargo.toml deleted file mode 100644 index 1a57651..0000000 --- a/src/uu/pwdx/Cargo.toml +++ /dev/null @@ -1,17 +0,0 @@ -[package] -name = "uu_pwdx" -version = "0.0.1" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -uucore = { workspace = true } -clap = { workspace = true } - -[lib] -path = "src/pwdx.rs" - -[[bin]] -name = "pwdx" -path = "src/main.rs" diff --git a/src/uu/pwdx/pwdx.md b/src/uu/pwdx/pwdx.md deleted file mode 100644 index 0efb6d6..0000000 --- a/src/uu/pwdx/pwdx.md +++ /dev/null @@ -1,7 +0,0 @@ -# pwdx - -``` -pwdx [options] pid [...] -``` - -Report current working directory of a process \ No newline at end of file diff --git a/src/uu/pwdx/src/main.rs b/src/uu/pwdx/src/main.rs deleted file mode 100644 index ee1a336..0000000 --- a/src/uu/pwdx/src/main.rs +++ /dev/null @@ -1 +0,0 @@ -uucore::bin!(uu_pwdx); diff --git a/src/uu/pwdx/src/pwdx.rs b/src/uu/pwdx/src/pwdx.rs deleted file mode 100644 index c38e403..0000000 --- a/src/uu/pwdx/src/pwdx.rs +++ /dev/null @@ -1,52 +0,0 @@ -// This file is part of the uutils util-linux package. -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. - -use clap::Arg; -use clap::{crate_version, Command}; -use std::env; -use std::fs; -use std::path::Path; -use std::process; - -use uucore::{error::UResult, format_usage, help_about, help_usage}; - -const ABOUT: &str = help_about!("pwdx.md"); -const USAGE: &str = help_usage!("pwdx.md"); - -#[uucore::main] -pub fn uumain(args: impl uucore::Args) -> UResult<()> { - - let matches = uu_app().try_get_matches_from(args)?; - - let pid_str = matches.get_one::("pid").unwrap(); - let pid = pid_str.parse::().unwrap_or_else(|_| { - eprintln!("Invalid PID"); - process::exit(1); - }); - - let cwd_link = format!("/proc/{}/cwd", pid); - - match fs::read_link(Path::new(&cwd_link)) { - Ok(path) => println!("{}: {}", pid, path.display()), - Err(e) => { - eprintln!("pwdx: failed to read link for PID {}: {}", pid, e); - process::exit(1); - } - } - Ok(()) -} - -pub fn uu_app() -> Command { - Command::new(uucore::util_name()) - .version(crate_version!()) - .about(ABOUT) - .override_usage(format_usage(USAGE)) - .infer_long_args(true) - .arg(Arg::new("pid") - .value_name("PID") - .help("Process ID") - .required(true) - .index(1)) -} diff --git a/tests/by-util/test_pwdx.rs b/tests/by-util/test_pwdx.rs deleted file mode 100644 index ca96aff..0000000 --- a/tests/by-util/test_pwdx.rs +++ /dev/null @@ -1,14 +0,0 @@ -// This file is part of the uutils util-linux package. -// -// For the full copyright and license information, please view the LICENSE -// file that was distributed with this source code. -// spell-checker:ignore (words) symdir somefakedir - -use std::path::PathBuf; - -use crate::common::util::{TestScenario, UCommand}; - -#[test] -fn test_invalid_arg() { - new_ucmd!().arg("--definitely-invalid").fails().code_is(1); -} diff --git a/tests/tests.rs b/tests/tests.rs index 44e3fdd..9726824 100644 --- a/tests/tests.rs +++ b/tests/tests.rs @@ -9,10 +9,6 @@ mod common; #[path = "by-util/test_lscpu.rs"] mod test_lscpu; -#[cfg(feature = "pwdx")] -#[path = "by-util/test_pwdx.rs"] -mod test_pwdx; - #[cfg(feature = "mountpoint")] #[path = "by-util/test_mountpoint.rs"] mod test_mountpoint;