rich/examples/listdir.py

13 lines
272 B
Python
Raw Normal View History

2020-05-31 11:56:25 +00:00
import os
import sys
from rich import print
from rich.columns import Columns
if len(sys.argv) < 2:
print("Usage: python columns.py DIRECTORY")
else:
directory = os.listdir(sys.argv[1])
columns = Columns(directory, equal=True, expand=True)
print(columns)