@@ -9,6 +9,7 @@ Count LOC (lines of code) & TOK (LLM tokens), fast.
99- Gitignore-aware scan (respects ` .gitignore ` , global gitignore, and git excludes)
1010- Tiktoken encodings: ` o200k_base ` (default), ` cl100k_base ` , ` p50k_base ` , ` p50k_edit ` , ` r50k_base `
1111- By-language summary table, JSON report, or file tree view
12+ - Copy mode to concatenate filtered files into a clipboard-ready payload
1213- Extension filter via ` --ext rs,py,ts ` (case-insensitive, no leading dots)
1314- Optional inclusion of hidden files via ` --hidden `
1415- Fast parallel scanning (Rayon) with a live progress indicator (stderr)
@@ -62,6 +63,13 @@ loctok --hidden
6263
6364# Progress prints to stderr; to silence in scripts, redirect:
6465loctok --format json 2> /dev/null
66+
67+ # Concatenate filtered files and copy to clipboard
68+ loctok copy # from current directory
69+ loctok copy path/to/dir # from a given path
70+
71+ # Copy with filters and also print the content
72+ loctok --ext rs,md --hidden copy --show
6573```
6674
6775Run ` loctok --help ` to see all options.
@@ -158,11 +166,50 @@ Name LOC TOK
158166}
159167```
160168
169+ ## Copy Mode
170+
171+ Use copy to bundle filtered files into a single, structured payload that is copied to your clipboard. Optionally print it with ` --show ` .
172+
173+ ```
174+ loctok copy [PATH] [--show] [--ext rs,md] [--hidden]
175+ ```
176+
177+ What it does:
178+
179+ - Renders a tree of the included files
180+ - Appends each file as a section with a header and numbered lines
181+ - Copies the entire payload to your system clipboard
182+ - Prints a summary like: ` Copied 123 lines (22,333 tokens) `
183+
184+ Snippet of the format:
185+
186+ ```
187+ ├── src
188+ │ ├── lib.rs
189+ │ └── main.rs
190+ └── README.md
191+
192+ /src/lib.rs:
193+ --------------------------------------------------------------------------------
194+ 1 | use anyhow::{Context, Result};
195+ 2 | // ...
196+
197+
198+ /README.md:
199+ --------------------------------------------------------------------------------
200+ 1 | # loctok
201+ 2 | Count LOC and tokens
202+ ```
203+
161204## Behavior and Notes
162205
163206- Respects ` .gitignore ` , global gitignore, and git excludes; also adds ` .gitignore ` as a custom ignore file in non-git contexts.
164207- Only UTF‑8 text files are counted; non‑UTF‑8 files are skipped silently.
165208- Language grouping is inferred from file extensions.
209+ - Copy mode requires a platform clipboard tool:
210+ - macOS: ` pbcopy `
211+ - Windows: ` clip `
212+ - Linux: ` xclip ` or ` xsel `
166213
167214## License
168215
0 commit comments