Smart file and directory viewer
Project description
L command
l command is a smart file and directory viewer that can replace both less and ls. It intelligently detects the content type and displays it in the most appropriate way.
Usage
l /path/to/file: Display file content appropriately- PDF files: Extract and display text content using
pdfminer.six - Image files: Display in terminal using
timgor show metadata - Audio/Video files: Show detailed metadata using
ffprobe - XML/HTML files: Format and validate using
xmllint - CSV/TSV files: Display structured table with column information
- Markdown files: Render using
glow,mdcat, orpandoc - YAML files: Format and validate using
yqwith color output - JSON files: Format and display using
jq - Archive files: List contents using appropriate tools (
unzip -l,tar -tvf) - Binary files: Display using
hexdump -C - Text files: Short files via
cat, long files vialess -RFX
- PDF files: Extract and display text content using
l /path/to/directory: Works asls -la --color=auto /path/to/directory
Detailed Behavior
File Type Detection and Processing
The tool uses a priority-based handler system to process different file types:
Priority Order: Image (65) > PDF (60) > Media (55) > JSON (50) > XML/HTML (45) > CSV (40) > Markdown (35) > YAML (30) > Archive (80) > Binary (20) > Default (0)
PDF Files (Priority: 60)
- Extensions:
.pdf - Content Detection: Files starting with
%PDF- - Processing: Extract text using
pdfminer.six, display metadata and content - Fallback: Show file information when
pdfminer.sixis unavailable
Image Files (Priority: 65)
- Extensions:
.png,.jpg,.jpeg,.gif,.bmp,.webp,.tiff,.tif - Content Detection: Magic bytes for PNG, JPEG, GIF, BMP, WebP, TIFF
- Processing: Display in terminal using
timg, show dimensions and metadata - Fallback: Show file information and dimensions when
timgis unavailable
Audio/Video Files (Priority: 55)
- Extensions: Audio (
.mp3,.flac,.wav,.aac,.ogg,.m4a,.wma), Video (.mp4,.mkv,.avi,.mov,.wmv,.flv,.webm,.m4v,.3gp) - Processing: Analyze using
ffprobeto show format, duration, bitrate, streams, and metadata - Fallback: Show basic file information when
ffmpegis unavailable
XML/HTML Files (Priority: 45)
- Extensions:
.xml,.html,.htm,.xhtml,.svg,.xsl,.xslt - Content Detection: XML declaration, DOCTYPE, or XML/HTML tag patterns
- Processing: Format using
xmllint --format, validate syntax - Fallback: Show raw content when
xmllintis unavailable
CSV/TSV Files (Priority: 40)
- Extensions:
.csv,.tsv,.txt(with CSV content detection) - Content Detection: Consistent delimiter patterns across lines
- Processing: Display structured table with column headers and data preview
- Features: Auto-detect delimiters (comma, tab, semicolon, pipe), show row/column counts
Markdown Files (Priority: 35)
- Extensions:
.md,.markdown,.mdown,.mkd,.mdx - Processing: Render using
glow(with smart paging),mdcat, orpandoc - Features: Smart paging based on content length, syntax highlighting fallback with
bat - Fallback: Show source with syntax highlighting
YAML Files (Priority: 30)
- Extensions:
.yaml,.yml - Content Detection: YAML document markers (
---,%YAML) or YAML structure patterns - Processing: Format using
yq --colors, validate syntax - Fallback: Show raw content with syntax highlighting when
yqis unavailable
JSON Files (Priority: 50)
- Extensions:
.json - Content Detection: Files starting with
{or[(UTF-8 encoded) - Processing: Format using
jq --color-output, validate syntax - Features: Size limit check (10MB), smart paging
- Fallback: Show raw content for invalid JSON or when
jqis unavailable
Archive Files (Priority: 80)
- Extensions: ZIP (
.zip,.jar,.war,.ear,.apk,.ipa), TAR (.tar.gz,.tgz,.tar.bz2,.tbz2,.tar.xz,.txz,.tar.zst) - Processing: List contents using
unzip -lortar -tvf - Features: Smart paging for large archive listings
Binary Files (Priority: 20)
- Detection: Uses
filecommand or content-based detection (null bytes, non-printable characters) - Processing: Display using
hexdump -C - Features: Handles various binary formats
Text Files (Default Priority: 0)
- Processing: Automatically detects file size and line count
- Features: Uses
catfor short files,less -RFXfor long files - Smart Paging: Compares file line count with terminal height
Options
Currently, the command line arguments are as follows:
- Positional argument
path: Path to the file or directory to display (default: current directory.)
Use Cases
- View file content quickly:
l file.txt - Check directory contents:
l ./myfolder - Read PDF documents:
l document.pdf - View images in terminal:
l image.png - Analyze media files:
l video.mp4orl audio.mp3 - Format structured data:
l data.json,l config.yaml,l data.csv - Read documentation:
l README.md - Validate markup:
l page.html,l config.xml - Inspect archives:
l archive.zip,l backup.tar.gz - Debug binary files:
l binary.bin
Optional Dependencies
For enhanced functionality, install these optional tools:
- PDF support:
pip install pdfminer.six - Image display: Install
timgvia your package manager - Media analysis: Install
ffmpeg(includesffprobe) - XML formatting: Install
libxml2-utils(includesxmllint) - Markdown rendering: Install
glow,mdcat, orpandoc - YAML processing: Install
yq - Syntax highlighting: Install
batfor enhanced fallback display
The tool gracefully handles missing dependencies by showing basic file information and falling back to appropriate display methods.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file l_command-0.3.0.tar.gz.
File metadata
- Download URL: l_command-0.3.0.tar.gz
- Upload date:
- Size: 21.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4fe229aaeade00d7f6ee3d234f75428d8363bdb0118d6f78129e1281a9565b4
|
|
| MD5 |
e6a5cf0c44894e2394311def0bdc1c81
|
|
| BLAKE2b-256 |
82a8e22f8ca73b259324c6d963285d51542433617cae061df947fe0ed6f37319
|
Provenance
The following attestation bundles were made for l_command-0.3.0.tar.gz:
Publisher:
release.yml on gyu-don/l-command
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
l_command-0.3.0.tar.gz -
Subject digest:
a4fe229aaeade00d7f6ee3d234f75428d8363bdb0118d6f78129e1281a9565b4 - Sigstore transparency entry: 230017643
- Sigstore integration time:
-
Permalink:
gyu-don/l-command@5fa0d01a0fce620bdf4edc719c4e17412704f88c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gyu-don
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5fa0d01a0fce620bdf4edc719c4e17412704f88c -
Trigger Event:
release
-
Statement type:
File details
Details for the file l_command-0.3.0-py3-none-any.whl.
File metadata
- Download URL: l_command-0.3.0-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac6bd48f3f24692650e295d2158853a07c51e99e4661fe1d272dc409b093773d
|
|
| MD5 |
f52c8978c36ec9451a9d4b0fe2a8521d
|
|
| BLAKE2b-256 |
baf1a8fa37a8291eeb25d4c74117e62591c59a41272809f545b92972ae54f0cd
|
Provenance
The following attestation bundles were made for l_command-0.3.0-py3-none-any.whl:
Publisher:
release.yml on gyu-don/l-command
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
l_command-0.3.0-py3-none-any.whl -
Subject digest:
ac6bd48f3f24692650e295d2158853a07c51e99e4661fe1d272dc409b093773d - Sigstore transparency entry: 230017648
- Sigstore integration time:
-
Permalink:
gyu-don/l-command@5fa0d01a0fce620bdf4edc719c4e17412704f88c -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/gyu-don
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5fa0d01a0fce620bdf4edc719c4e17412704f88c -
Trigger Event:
release
-
Statement type: