mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 15:22:38 +00:00
Merge pull request #3681 from cakebaker/realpath_add_no_symlinks_alias
realpath: add "--no-symlinks" alias
This commit is contained in:
commit
5b34b9a97b
2 changed files with 33 additions and 26 deletions
|
@ -86,6 +86,7 @@ pub fn uu_app<'a>() -> Command<'a> {
|
|||
Arg::new(OPT_STRIP)
|
||||
.short('s')
|
||||
.long(OPT_STRIP)
|
||||
.visible_alias("no-symlinks")
|
||||
.help("Only strip '.' and '..' components, but don't resolve symbolic links"),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -65,50 +65,56 @@ fn test_realpath_file_and_links_zero() {
|
|||
|
||||
#[test]
|
||||
fn test_realpath_file_and_links_strip() {
|
||||
let strip_args = ["-s", "--strip", "--no-symlinks"];
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.touch("foo");
|
||||
at.symlink_file("foo", "bar");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("foo")
|
||||
.arg("-s")
|
||||
.succeeds()
|
||||
.stdout_contains("foo\n");
|
||||
for strip_arg in strip_args {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("foo")
|
||||
.arg(strip_arg)
|
||||
.succeeds()
|
||||
.stdout_contains("foo\n");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("bar")
|
||||
.arg("-s")
|
||||
.succeeds()
|
||||
.stdout_contains("bar\n");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("bar")
|
||||
.arg(strip_arg)
|
||||
.succeeds()
|
||||
.stdout_contains("bar\n");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_realpath_file_and_links_strip_zero() {
|
||||
let strip_args = ["-s", "--strip", "--no-symlinks"];
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.touch("foo");
|
||||
at.symlink_file("foo", "bar");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("foo")
|
||||
.arg("-s")
|
||||
.arg("-z")
|
||||
.succeeds()
|
||||
.stdout_contains("foo\u{0}");
|
||||
for strip_arg in strip_args {
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("foo")
|
||||
.arg(strip_arg)
|
||||
.arg("-z")
|
||||
.succeeds()
|
||||
.stdout_contains("foo\u{0}");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("bar")
|
||||
.arg("-s")
|
||||
.arg("-z")
|
||||
.succeeds()
|
||||
.stdout_contains("bar\u{0}");
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("bar")
|
||||
.arg(strip_arg)
|
||||
.arg("-z")
|
||||
.succeeds()
|
||||
.stdout_contains("bar\u{0}");
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue