lf – lightning-fast project snapshotter (code + docs ⇢ clipboard / file)
# everything except hidden + Node artefacts
lf . @.git @node_modules # → clipboard
# whole project → file
lf . -o gist.txt
# only src/, exclude utils/
lf src @src/utils/**/*.ts
# Full build with token counting (default)
cargo build --release
# Slim build (no token counting, smaller binary)
cargo build --release --no-default-features
- On Windows, the default binary is ~5.0 MB
- With
--no-default-features
, it shrinks to ~1.07 MB
The executable will be in target/release/lf
.
On Linux and WSL, clipboard functionality requires additional system dependencies:
For X11:
sudo apt-get install xclip
# or
sudo apt-get install xsel
For Wayland:
sudo apt-get install wl-clipboard
For WSL specifically:
- WSL2 with WSLg (Windows 11) has built-in clipboard support
- Older WSL versions may need
xclip
orxsel
with X server configured
If clipboard dependencies are not installed, lf
will print the output to stdout with an informative error message.
- Include / Exclude – glob, prefix
@
to drop. - Shell Escaping – On Unix systems, quote exclusion patterns:
lf . "@.git" "@node_modules"
- Hidden rule – any path with
/.
ignored unless your pattern also starts with.
or contains/.
. - Directory shorthand – bare dir name ⇒
<dir>/**
. - .gitignore aware – by default, entries ignored by
.gitignore
, global gitignore, and.git/info/exclude
are skipped. Use--no-gitignore
to disable.
Intention | Command |
---|---|
Add single hidden file | lf . .env |
Add hidden dir | lf . .obsidian |
Everything, even hidden | lf "**/*" |
Only Rust tests | lf **/*_test.rs |
# Get all .rs files in the project
lf *.rs
# Get specific files
lf src/main.rs Cargo.toml README.md
# Get all files in src directory
lf src/
# All Rust files except tests
lf **/*.rs @**/*test*
# Everything except hidden directories and node_modules
lf . @.git @node_modules @.vscode
**Note:** On Unix shells (bash, zsh), quote exclusion patterns to prevent shell interpretation:
```bash
lf . "@.git" "@node_modules" "@.vscode"
### Hidden Files
Hidden files (starting with `.`) are excluded by default unless explicitly
specified:
```bash
# This will NOT include .env, .gitignore, etc.
lf *
# This WILL include .env specifically
lf src/ .env .gitignore
# This will include ALL files including hidden ones
lf "**/*"
# Write to file instead of clipboard
lf *.rs -o output.txt
# Disable clipboard (write to stdout)
lf *.rs --no-clipboard
# Pipe to other commands
lf *.rs --no-clipboard | grep "TODO"
By default lf
honors .gitignore
, global gitignore, and Git exclude files using the same engine as ripgrep
.
Examples:
# Respect .gitignore (default)
lf . --no-clipboard
# Ignore .gitignore rules (include everything that matches patterns)
lf . --no-gitignore --no-clipboard
If you want to anonymize Java imports (replace import something
with import ...
) use:
# Mask imports in Java files
lf . --mask-java-imports
Binary files are detected by extension and show metadata instead of content:
target/release/lf.exe
[Binary file: EXE - Size: 2.3 MB]
Supported binary types: executables, images, videos, audio, archives, documents, and more.
Hidden Path Semantics
"Hidden" means any path component beginning with dot – aligns with POSIX and Git-ignore semantics.
A basic test was added to ensure Java import masking behavior. See tests/hidden.rs
.