Skip to content

Commit c861e92

Browse files
committed
v0.4.2: major refactor with modular architecture and comprehensive git integration
- Refactored monolithic main.rs. - Added comprehensive git integration: - for tracked files only - for untracked files - for staged files - for modified/changed files - flag to start from git root with any git mode - Color-coded output (staged=green, changed=yellow, untracked=red) - Git branch display in output - Fixed /home/turtle/_projects/03_rust/struct-cli (master) Cargo.toml /home/turtle/_projects/03_rust/struct-cli/Cargo.toml 750B src/ /home/turtle/_projects/03_rust/struct-cli/src total: 7 files · 41.2K types: rs(7) Cargo.lock /home/turtle/_projects/03_rust/struct-cli/Cargo.lock 21.1K .gitignore /home/turtle/_projects/03_rust/struct-cli/.gitignore 58B README.md /home/turtle/_projects/03_rust/struct-cli/README.md 12.1K docs/ /home/turtle/_projects/03_rust/struct-cli/docs total: 3 files · 35.9K types: html(1) js(1) css(1) install.sh /home/turtle/_projects/03_rust/struct-cli/install.sh 5.9K uninstall.sh /home/turtle/_projects/03_rust/struct-cli/uninstall.sh 3.4K .cargoignore /home/turtle/_projects/03_rust/struct-cli/.cargoignore 47B .github/ /home/turtle/_projects/03_rust/struct-cli/.github total: 2 dirs · 3 files · 1.2K types: md(2) yml(1) ── ignored (top level) ── .git(168 files), target(2399 files) · 2567 files · 751.5M vs . (git:master) ├── .git/ (168 files ignored) ├── .github/ ├── docs/ ├── src/ ├── target/ (2399 files ignored) ├── .cargoignore ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── install.sh ├── README.md └── uninstall.sh: 0=detailed summary, 1=simple one-level tree - Enhanced search to find both files AND directories - Added flag (pulls from Cargo.toml) - Improved path handling with canonicalization for git mode - Created interactive install.sh and uninstall.sh scripts - Updated README with comprehensive documentation
1 parent 44d6d00 commit c861e92

7 files changed

Lines changed: 447 additions & 107 deletions

File tree

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "struct-cli"
3-
version = "0.3.3"
3+
version = "0.4.2"
44
edition = "2021"
55
authors = ["Coffee Nerd nerdcoffeemail@gmail.com"]
66
description = "A smarter tree command with intelligent defaults. Filters out common clutter like node_modules and venv, supports custom ignore patterns, and includes advanced features such as file search, directory summaries, size-aware filtering, and git integration."

README.md

Lines changed: 114 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,104 @@ struct 2 --path /etc # /etc, 2 levels
146146
147147
---
148148
149+
### Git Integration
150+
151+
`struct` now has comprehensive git support, allowing you to filter files by their git status.
152+
153+
#### `-g, --git`
154+
Show only git-tracked files (ignores everything not in git).
155+
156+
```bash
157+
struct 2 -g # Git-tracked files only
158+
struct 3 --git # Long form
159+
```
160+
161+
**Output:**
162+
```
163+
src/
164+
├── main.rs (tracked)
165+
├── lib.rs (tracked)
166+
└── utils.rs (tracked)
167+
168+
tests/
169+
└── integration_test.rs (tracked)
170+
```
171+
172+
**Use case:** Clean view of actual source code without build artifacts.
173+
174+
#### `--gu`
175+
Show only untracked files (not yet added to git).
176+
177+
```bash
178+
struct 2 --gu # Untracked files only
179+
```
180+
181+
**Output (color-coded red for visibility):**
182+
```
183+
.env (untracked)
184+
debug.log (untracked)
185+
tmp/
186+
└── cache.tmp (untracked)
187+
```
188+
189+
#### `--gs`
190+
Show only staged files (ready to commit).
191+
192+
```bash
193+
struct 2 --gs # Staged files only
194+
```
195+
196+
**Output (color-coded green for visibility):**
197+
```
198+
src/
199+
├── main.rs (staged)
200+
└── lib.rs (staged)
201+
202+
README.md (staged)
203+
```
204+
205+
#### `--gc`
206+
Show only modified/changed files (unstaged changes).
207+
208+
```bash
209+
struct 2 --gc # Modified files only
210+
```
211+
212+
**Output (color-coded yellow for visibility):**
213+
```
214+
src/
215+
├── main.rs (modified)
216+
└── config.rs (modified)
217+
218+
tests/unit_test.rs (modified)
219+
```
220+
221+
#### `--gr`
222+
Start from git root (repository root) with any git mode. Useful when inside a subdirectory of a git repo.
223+
224+
```bash
225+
struct 2 -g --gr # Git-tracked files from repo root
226+
struct 3 --gc --gr # Modified files from repo root
227+
struct 1 --gs --gr # Staged files from repo root
228+
```
229+
230+
**Use case:** Get consistent output regardless of your current working directory within the repository.
231+
232+
**Git Mode Features:**
233+
- **Color-coded output**: Green (staged), Yellow (modified), Red (untracked)
234+
- **Git branch display**: Shows current branch in output
235+
- **Clean filtering**: Automatically respects `.gitignore`
236+
- **Combinable**: Can combine git modes with other flags like `-z` for sizes
237+
238+
**Examples:**
239+
```bash
240+
struct 3 -g -z # Tracked files with sizes
241+
struct 2 --gu --gr # Untracked files from repo root
242+
struct 3 --gs -z --gr # Staged files with sizes from repo root
243+
```
244+
245+
---
246+
149247
### Flags and Options
150248
151249
#### `-z, --size`
@@ -172,14 +270,7 @@ struct 5 -p ~/code -z # Code folder with sizes
172270
```
173271
174272
#### `-g, --git`
175-
Show only git-tracked files (ignores everything not in git).
176-
177-
```bash
178-
struct 2 -g # Git-tracked files only
179-
struct 3 --git # Long form
180-
```
181-
182-
**Use case:** Clean view of actual source code without build artifacts.
273+
**Deprecated:** Use Git Integration section above instead. This flag shows git-tracked files.
183274
184275
#### `-s, --skip-large SIZE_MB`
185276
Skip folders larger than specified size in megabytes.
@@ -219,6 +310,18 @@ struct 1 -n node_modules # Peek inside node_modules
219310
struct 3 --no-ignore all # Long form
220311
```
221312
313+
#### `--version`
314+
Display the version of struct-cli.
315+
316+
```bash
317+
struct --version
318+
```
319+
320+
**Output:**
321+
```
322+
struct-cli 0.4.2
323+
```
324+
222325
**Combining flags:**
223326
```bash
224327
struct 3 -z -g # Git-tracked files with sizes
@@ -278,7 +381,7 @@ struct clear
278381
279382
### Search
280383
281-
Find files by pattern across your project.
384+
Find files AND directories by pattern across your project.
282385
283386
```bash
284387
struct search PATTERN [OPTIONS] [PATH]
@@ -333,6 +436,8 @@ found 12 file(s) matching *.py
333436
/home/user/projects/01_python/timebomb/timebomb.py (5.7K)
334437
```
335438
439+
**Note:** Search results include both files and directories matching your pattern.
440+
336441
**Combining search options:**
337442
```bash
338443
struct search "*.rs" -d 2 -f # Rust files, 2 levels, flat

docs/index.html

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<div class="text-center space-y-8 animate-fade-in">
9797
<div class="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-github-border/30 border border-github-border text-xs font-medium text-github-accent mb-4">
9898
<span class="flex w-2 h-2 rounded-full bg-orange-500 animate-pulse"></span>
99-
Built with Rust
99+
v0.4.2 • Rust • Built with 🦀
100100
</div>
101101

102102
<h1 class="text-5xl sm:text-6xl lg:text-7xl font-bold tracking-tight text-white">
@@ -228,8 +228,8 @@ <h3 class="text-lg font-semibold text-white mb-2">Built-in search</h3>
228228
<div class="w-12 h-12 rounded-lg bg-orange-500/10 flex items-center justify-center mb-4 group-hover:scale-110 transition-transform">
229229
<i data-lucide="git-branch" class="w-6 h-6 text-orange-500"></i>
230230
</div>
231-
<h3 class="text-lg font-semibold text-white mb-2">Git-aware</h3>
232-
<p class="text-github-muted text-sm leading-relaxed">Use <code class="text-github-accent bg-github-border/30 px-1 rounded">-g</code> flag to show only git-tracked files. Perfect for seeing what's actually in your repo.</p>
231+
<h3 class="text-lg font-semibold text-white mb-2">Comprehensive Git Integration</h3>
232+
<p class="text-github-muted text-sm leading-relaxed">Multiple git modes: tracked (<code class="text-github-accent bg-github-border/30 px-1 rounded">-g</code>), untracked (<code class="text-github-accent bg-github-border/30 px-1 rounded">--gu</code>), staged (<code class="text-github-accent bg-github-border/30 px-1 rounded">--gs</code>), modified (<code class="text-github-accent bg-github-border/30 px-1 rounded">--gc</code>). Color-coded output with branch display.</p>
233233
</div>
234234

235235
<!-- Blazing fast -->
@@ -261,6 +261,16 @@ <h4 class="text-white font-medium">Depth Control</h4>
261261
</div>
262262
</div>
263263

264+
<div class="flex items-start gap-4">
265+
<div class="w-6 h-6 rounded bg-github-accent/20 flex items-center justify-center flex-shrink-0 mt-0.5">
266+
<i data-lucide="check" class="w-4 h-4 text-github-accent"></i>
267+
</div>
268+
<div>
269+
<h4 class="text-white font-medium">Git Integration</h4>
270+
<p class="text-github-muted text-sm">Track (<code class="text-github-accent">-g</code>), staged (<code class="text-github-accent">--gs</code>), modified (<code class="text-github-accent">--gc</code>), untracked (<code class="text-github-accent">--gu</code>) with color-coding</p>
271+
</div>
272+
</div>
273+
264274
<div class="flex items-start gap-4">
265275
<div class="w-6 h-6 rounded bg-github-accent/20 flex items-center justify-center flex-shrink-0 mt-0.5">
266276
<i data-lucide="check" class="w-4 h-4 text-github-accent"></i>
@@ -319,13 +329,19 @@ <h4 class="text-white font-medium">Flexible Output</h4>
319329
<span class="text-github-green">$</span> <span class="text-github-text">struct 2 -g</span>
320330
</div>
321331
<div class="code-line">
322-
<span class="syntax-comment"># Search for Python files</span>
332+
<span class="syntax-comment"># Show staged files with green color</span>
333+
</div>
334+
<div class="code-line">
335+
<span class="text-github-green">$</span> <span class="text-github-text">struct 3 --gs --gr</span>
336+
</div>
337+
<div class="code-line">
338+
<span class="syntax-comment"># Search for Python files & folders</span>
323339
</div>
324340
<div class="code-line">
325341
<span class="text-github-green">$</span> <span class="text-github-text">struct search "*.py" -f</span>
326342
</div>
327343
<div class="code-line">
328-
<span class="syntax-comment"># Summary mode</span>
344+
<span class="syntax-comment"># Summary mode with stats</span>
329345
</div>
330346
<div class="code-line">
331347
<span class="text-github-green">$</span> <span class="text-github-text">struct 0</span>

0 commit comments

Comments
 (0)