-
-
Save richardkiss/4fba0c6bd27eb39a9eb56074dd0f2ba4 to your computer and use it in GitHub Desktop.
A "mirror-image" ls in python, as discussed at https://news.ycombinator.com/item?id=16716150
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import subprocess | |
import sys | |
output = subprocess.check_output(["ls"] + sys.argv[1:]) | |
lines = output.split("\n") | |
size = max(len(_) for _ in lines) | |
spaces = " " * size | |
for l in lines: | |
line = (l + spaces)[:size] | |
line = ''.join(list(reversed(line))) | |
print(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment