pwdx is part of procps - moved https://github.com/uutils/procps
This commit is contained in:
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -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"
|
||||
|
@@ -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" }
|
||||
|
@@ -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"
|
@@ -1,7 +0,0 @@
|
||||
# pwdx
|
||||
|
||||
```
|
||||
pwdx [options] pid [...]
|
||||
```
|
||||
|
||||
Report current working directory of a process
|
@@ -1 +0,0 @@
|
||||
uucore::bin!(uu_pwdx);
|
@@ -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))
|
||||
}
|
@@ -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);
|
||||
}
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user