blob: 64b86a811bc3488a847b2b9730ec6f7d1b12c1ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# treecat
treecat is a tiny Bash utility that combines `tree` + `cat`: it prints files or entire directory trees (when invoked with `-r`) recursively, wrapping each file’s contents in Markdown code blocks.
## Features
- **Non-recursive by default** (only top-level files): use `-r/--recursive` to descend.
- **Exclude patterns** with `-e/--exclude` (glob syntax).
- **Include patterns** with `-I/--include` (glob syntax).
- **Always outputs** basic Markdown code blocks with `File Name: <path>:` header.
## Installation
### From AUR
```bash
# with an AUR helper
yay -S treecat
```
# or manually
```bash
git clone https://aur.archlinux.org/treecat.git
cd treecat
makepkg -si
```
### From GitHub
```bash
git clone https://github.com/amitpalsbadhan/treecat.git
cd treecat
sudo install -Dm755 treecat.sh /usr/local/bin/treecat
```
## Usage
```bash
# cat a single file
treecat README.md
# non-recursive tree + cat of a directory
treecat src/
# recursive
treecat -r src/
# recursive, skipping markdown & binary images
treecat -r -e '*.md' -e '*.png' src/
# only include shell & C++ files
treecat -r -I '*.sh' -I '*.cpp' .
```
## Options
- `-r, --recursive` Recurse into directories
- `-e, --exclude PATTERN...` Exclude files matching these globs
- `-I, --include PATTERN...` Only include files matching these globs
- `-h, --help` Show help
- `--version` Show version
## License
MIT © Amitpal Badhan
|