pwdx is part of procps - moved https://github.com/uutils/procps

This commit is contained in:
Sylvestre Ledru
2024-01-26 20:22:10 +01:00
parent 3229e5046f
commit 8349d5cf6a
8 changed files with 0 additions and 106 deletions

9
Cargo.lock generated
View File

@@ -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"

View File

@@ -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" }

View File

@@ -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"

View File

@@ -1,7 +0,0 @@
# pwdx
```
pwdx [options] pid [...]
```
Report current working directory of a process

View File

@@ -1 +0,0 @@
uucore::bin!(uu_pwdx);

View File

@@ -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::<String>("pid").unwrap();
let pid = pid_str.parse::<i32>().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))
}

View File

@@ -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);
}

View File

@@ -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;