Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

realpath: implement missing command-line arguments #2253

Closed
jfinkels opened this issue May 22, 2021 · 4 comments
Closed

realpath: implement missing command-line arguments #2253

jfinkels opened this issue May 22, 2021 · 4 comments

Comments

@jfinkels
Copy link
Collaborator

GNU coreutils realpath v8.28 has the following arguments:

$ realpath --help
Usage: realpath [OPTION]... FILE...
Print the resolved absolute file name;
all but the last component must exist

  -e, --canonicalize-existing  all components of the path must exist
  -m, --canonicalize-missing   no path components need exist or be a directory
  -L, --logical                resolve '..' components before symlinks
  -P, --physical               resolve symlinks as encountered (default)
  -q, --quiet                  suppress most error messages
      --relative-to=DIR        print the resolved path relative to DIR
      --relative-base=DIR      print absolute paths unless paths below DIR
  -s, --strip, --no-symlinks   don't expand symlinks
  -z, --zero                   end each output line with NUL, not newline

      --help     display this help and exit
      --version  output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
Full documentation at: <http://www.gnu.org/software/coreutils/realpath>
or available locally via: info '(coreutils) realpath invocation'

whereas the uutils version has only

$ ./target/debug/coreutils realpath -h
realpath 0.0.6
print the resolved path

USAGE:
    realpath [OPTION]... FILE...

FLAGS:
    -h, --help       Prints help information
    -q, --quiet      Do not print warnings for invalid paths
    -s, --strip      Only strip '.' and '..' components, but don't resolve symbolic links
    -V, --version    Prints version information
    -z, --zero       Separate output filenames with \0 rather than newline

ARGS:
    <files>...    

Specifically, it is missing options -e, -m, -L, --relative-to, and --relative-base.

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Jun 2, 2021

Actually, -L is implemented and -P is missing:

❯ exa --tree
.
├── a
│  ├── b
│  └── hello.txt
└── b.link -> a/b

GNU:

❯ realpath b.link/../hello.txt
/home/terts/Programming/coreutils/test_folder/a/hello.txt <-- inside a
❯ realpath -L b.link/../hello.txt
/home/terts/Programming/coreutils/test_folder/hello.txt   <-- outside a

Uutils:

❯ uu_realpath b.link/../hello.txt
/home/terts/Programming/coreutils/test_folder/hello.txt   <-- outside a

@jfinkels
Copy link
Collaborator Author

Pull request #2459 implemented -L and -P so the remaining options to be implemented are

  -e, --canonicalize-existing  all components of the path must exist
  -m, --canonicalize-missing   no path components need exist or be a directory
      --relative-to=DIR        print the resolved path relative to DIR
      --relative-base=DIR      print absolute paths unless paths below DIR

@jaggededgedjustice
Copy link
Contributor

jaggededgedjustice commented Aug 22, 2021

I'm working on adding the -e/-m option.

@niyaznigmatullin
Copy link
Contributor

PR #3710 implemented --relative-to and --relative-base.

-e and -m were implemented before, I think this can be closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants