git @ Cat's Eye Technologies realpath / 445e28a
Merge pull request #1 from catseye/develop-2.0 Update to use Python 3. Chris Pressey authored 2 years ago GitHub committed 2 years ago
3 changed file(s) with 32 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
+0
-30
README.markdown less more
0 `realpath`
1 ==========
2
3 This is Cat's Eye Technologies' `realpath`, a simple command-line tool that
4 resolves relative file paths to absolute ones. It:
5
6 * is written in Python (tested with 2.7.6)
7 * is small and has no dependencies besides Python
8 * is in the public domain (see `UNLICENSE`)
9 * is trivial
10 * is not feature-compatible with GNU realpath
11 * has no build/install system; either copy it to somewhere on your
12 search path, or alter your search path to include the `script` directory
13 in this repo, or use some system that solves this problem, like
14 [toolshelf](http://catseye.tc/node/toolshelf).
15
16 Usage
17 -----
18
19 realpath PATH
20
21 Related work
22 ------------
23
24 * [realpath_1](http://leapfrog.freeshell.org/Projects/real_path.shtml) —
25 GPL'ed, and contains an unbuildable C version (nested comments) and an
26 incompatible Perl version of realpath.
27 * [dtjm/realpath](https://github.com/dtjm/realpath) — claims to be
28 "public domain" but is restricted to "non-profit use", which in my
29 IANAL opinion is a contradiction in terms.
0 `realpath`
1 ==========
2
3 This is Cat's Eye Technologies' `realpath`, a simple command-line tool that
4 resolves relative file paths to absolute ones. It:
5
6 * is written in Python 3 (tested with 3.8.10)
7 * is small and has no dependencies besides Python
8 * is in the public domain (see `UNLICENSE`)
9 * is trivial
10 * is not feature-compatible with GNU realpath
11 * has no build/install system; either copy it to somewhere on your
12 search path, or alter your search path to include the `script` directory
13 in this repo, or use some system that solves this problem, like
14 [shelf](http://catseye.tc/node/shelf).
15
16 Usage
17 -----
18
19 realpath PATH
20
21 Related work
22 ------------
23
24 * [realpath_1](http://leapfrog.freeshell.org/Projects/real_path.shtml) —
25 GPL'ed, and contains an unbuildable C version (nested comments) and an
26 incompatible Perl version of realpath.
27 * [dtjm/realpath](https://github.com/dtjm/realpath) — claims to be
28 "public domain" but is restricted to "non-profit use", which in my
29 IANAL opinion is a contradiction in terms.
0 #!/usr/bin/env python
0 #!/usr/bin/env python3
11
22 # Written by Chris Pressey of Cat's Eye Technologies.
33 # This work is in the public domain; see UNLICENSE for more information.
55 import os
66 import sys
77
8 print os.path.realpath(sys.argv[1])
8 print(os.path.realpath(sys.argv[1]))