zfish 0.1.10

Ultra-light, zero-dependency Rust CLI framework for building beautiful command-line applications
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
# Contributing to ZFish ๐Ÿฆˆ

Thank you for your interest in contributing to **ZFish**! We welcome contributions of all kinds: bug reports, feature requests, documentation improvements, and code contributions.

---

## ๐Ÿ“‹ Table of Contents

- [Code of Conduct]#code-of-conduct
- [How Can I Contribute?]#how-can-i-contribute
- [Development Setup]#development-setup
- [Commit Message Guidelines]#commit-message-guidelines
- [Pull Request Process]#pull-request-process
- [Coding Standards]#coding-standards
- [Testing Guidelines]#testing-guidelines
- [Documentation]#documentation
- [Release Process]#release-process

---

## ๐Ÿ“œ Code of Conduct

This project and everyone participating in it is governed by our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.

---

## ๐Ÿค How Can I Contribute?

### Reporting Bugs ๐Ÿ›

Before creating bug reports, please check the [existing issues](https://github.com/JeetKarena/ZFish/issues) to avoid duplicates.

**When filing a bug report, include:**

- A clear and descriptive title
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Your environment (OS, Rust version)
- Code samples if applicable
- Any relevant error messages

**Example:**

```markdown
**Bug**: Progress bar rendering incorrect on Windows Terminal

**Environment:**
- OS: Windows 11
- Rust: 1.90.0
- Terminal: Windows Terminal 1.20

**Steps to Reproduce:**
1. Run `cargo run --example 04_progress_bar`
2. Observe output

**Expected:** Progress bar shows smooth animation
**Actual:** Characters appear corrupted
```

### Suggesting Features ๐Ÿ’ก

We love feature suggestions! Please:

1. Check [existing issues]https://github.com/JeetKarena/ZFish/issues first
2. Create a new issue with the `enhancement` label
3. Describe the feature and its use case
4. Explain why this feature would be useful

### Contributing Code ๐Ÿ’ป

1. **Fork the repository**
2. **Create a feature branch** from `main`
   ```bash
   git checkout -b feat/your-feature-name
   ```
3. **Make your changes** following our [coding standards]#coding-standards
4. **Write tests** for your changes
5. **Run the test suite** to ensure everything passes
6. **Commit your changes** using [conventional commits]#commit-message-guidelines
7. **Push to your fork** and create a pull request

---

## ๐Ÿ› ๏ธ Development Setup

### Prerequisites

- **Rust 1.90.0 or later** (MSRV - Minimum Supported Rust Version)
- Git

### Setup Steps

1. **Clone your fork:**
   ```bash
   git clone https://github.com/YOUR_USERNAME/ZFish.git
   cd ZFish
   ```

2. **Add upstream remote:**
   ```bash
   git remote add upstream https://github.com/JeetKarena/ZFish.git
   ```

3. **Build the project:**
   ```bash
   cargo build
   ```

4. **Run tests:**
   ```bash
   cargo test
   ```

5. **Run examples:**
   ```bash
   cargo run --example 01_hello_world
   cargo run --example 04_progress_bar
   # ... etc
   ```

### Development Commands

```bash
# Build
cargo build

# Run all tests
cargo test

# Run specific test
cargo test test_terminal_size

# Check for lint warnings
cargo clippy --all-targets -- -D warnings

# Format code
cargo fmt --all

# Build documentation
cargo doc --no-deps --all-features --open

# Run examples
cargo run --example <example_name>
```

---

## ๐Ÿ“ Commit Message Guidelines

We use **[Conventional Commits](https://www.conventionalcommits.org/)** for clear, consistent commit history.

### Format

```
<type>(<scope>): <subject>

<body>

<footer>
```

### Types

| Type       | Semver Impact | Description                             |
| ---------- | ------------- | --------------------------------------- |
| `feat:`    | Minor         | A new feature                           |
| `fix:`     | Patch         | A bug fix                               |
| `docs:`    | None          | Documentation only changes              |
| `style:`   | None          | Code style changes (formatting, etc.)   |
| `refactor:`| None          | Code refactoring                        |
| `perf:`    | Patch         | Performance improvements                |
| `test:`    | None          | Adding or updating tests                |
| `build:`   | None          | Build system changes                    |
| `ci:`      | None          | CI configuration changes                |
| `chore:`   | None          | Other changes (dependencies, etc.)      |
| `feat!:`   | Major         | Breaking change (new feature)           |
| `fix!:`    | Major         | Breaking change (bug fix)               |

### Examples

```bash
# New feature (minor version impact)
feat: add table rendering support

# Bug fix (patch version impact)
fix: correct terminal size detection on Windows

# Breaking change (major version impact)
feat!: redesign Progress API to use builder pattern

BREAKING CHANGE: Progress::new() now requires builder pattern.
Use Progress::builder().total(100).build() instead.

# Documentation update
docs: add examples for color themes

# Multiple changes
feat: add spinner animation styles

- Implement 8 new spinner styles
- Add animation speed control
- Update documentation with examples
```

### Special Markers

- **`[skip ci]`** - Skip CI pipeline

```bash
git commit -m "docs: fix typo in readme [skip ci]"
```

---

## ๐Ÿ”€ Pull Request Process

### Before Submitting

1. โœ… Update documentation if needed
2. โœ… Add tests for new features
3. โœ… Run `cargo test` - all tests must pass
4. โœ… Run `cargo clippy --all-targets -- -D warnings` - no warnings
5. โœ… Run `cargo fmt --all` - code must be formatted
6. โœ… Update CHANGELOG.md if significant change
7. โœ… Ensure your branch is up to date with `main`

### Pull Request Template

```markdown
## Description
Brief description of what this PR does

## Type of Change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] Documentation update

## Testing
- [ ] All tests pass locally
- [ ] Added tests for new features
- [ ] Tested on: [OS/Platform]

## Checklist
- [ ] My code follows the project's coding standards
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
```

### Review Process

1. A maintainer will review your PR within a few days
2. Address any requested changes
3. Once approved, a maintainer will merge your PR
4. Your contribution will be included in the next release!

---

## ๐Ÿ“ Coding Standards

### Rust Style

- Follow the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)
- Use `cargo fmt` for consistent formatting
- Use `cargo clippy` to catch common mistakes
- Write idiomatic Rust code

### Code Quality

```rust
// โœ… Good - clear, documented, tested
/// Renders a progress bar to the terminal
///
/// # Arguments
/// * `current` - Current progress value
/// * `total` - Total progress value
///
/// # Examples
/// ```
/// use zfish::ProgressBar;
/// let pb = ProgressBar::new(100);
/// pb.render(50);
/// ```
pub fn render(&self, current: usize, total: usize) {
    // Implementation
}

// โŒ Bad - unclear, undocumented
pub fn do_thing(&self, a: usize, b: usize) {
    // ...
}
```

### Project-Specific Rules

- **Zero dependencies** - ZFish uses only the Rust standard library
- **Cross-platform** - Code must work on Windows, macOS, and Linux
- **Performance** - Avoid unnecessary allocations in hot paths
- **Safety** - Minimize use of `unsafe`, document when necessary
- **Compatibility** - Support MSRV (Rust 1.90.0)

### Module Organization

```
src/
โ”œโ”€โ”€ lib.rs          // Public API and re-exports
โ”œโ”€โ”€ args.rs         // Argument parsing
โ”œโ”€โ”€ log.rs          // Logging functionality
โ”œโ”€โ”€ progress.rs     // Progress bars
โ”œโ”€โ”€ prompt.rs       // Interactive prompts
โ”œโ”€โ”€ style.rs        // Color and styling
โ”œโ”€โ”€ term.rs         // Terminal control
โ””โ”€โ”€ os/             // Platform-specific code
    โ”œโ”€โ”€ mod.rs
    โ”œโ”€โ”€ unix.rs
    โ””โ”€โ”€ windows.rs
```

---

## ๐Ÿงช Testing Guidelines

### Test Coverage

- Write unit tests for all new functions
- Write integration tests for new features
- Test edge cases and error conditions
- Test on multiple platforms when possible

### Test Organization

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_progress_bar_creation() {
        let pb = ProgressBar::new(100);
        assert_eq!(pb.total, 100);
    }

    #[test]
    fn test_progress_bar_rendering() {
        let pb = ProgressBar::new(100);
        let output = pb.render(50);
        assert!(output.contains("50%"));
    }

    #[test]
    #[should_panic(expected = "total must be greater than 0")]
    fn test_invalid_progress_bar() {
        ProgressBar::new(0);
    }
}
```

### Running Tests

```bash
# Run all tests
cargo test

# Run specific test
cargo test test_progress_bar

# Run tests with output
cargo test -- --nocapture

# Run tests on a specific platform
cargo test --target x86_64-pc-windows-msvc

# Run ignored tests
cargo test -- --ignored
```

---

## ๐Ÿ“š Documentation

### Code Documentation

- Add doc comments (`///`) to all public items
- Include examples in doc comments
- Document edge cases and panics
- Use `cargo doc` to preview documentation

### Examples

```rust
/// Creates a new progress bar with the specified total
///
/// # Arguments
/// * `total` - The maximum value for the progress bar
///
/// # Panics
/// Panics if `total` is 0
///
/// # Examples
/// ```
/// use zfish::ProgressBar;
///
/// let pb = ProgressBar::new(100);
/// pb.set(50);  // 50%
/// ```
pub fn new(total: usize) -> Self {
    assert!(total > 0, "total must be greater than 0");
    Self { total, current: 0 }
}
```

### Documentation Files

When updating documentation:

- **README.md** - Project overview, quick start, features
- **CHANGELOG.md** - Version history and changes
- **Examples** - Working code examples in `examples/`
- **Rustdoc** - API documentation in code

---

## ๐Ÿš€ Release Process

### Manual Releases Only

ZFish uses **manual, intentional releases** to maintain proper semantic versioning and quality control.

**Contributors**: You don't need to worry about versioning. Just focus on your changes and use conventional commit messages.

**Maintainers**: See [`.github/RELEASE_PROCESS.md`](.github/RELEASE_PROCESS.md) for the complete release workflow.

### How It Works

1. Contributors submit PRs with their changes
2. Maintainers review and merge to `main`
3. When ready for release, maintainers:
   - Update version in `Cargo.toml` following semver
   - Update `CHANGELOG.md` with changes
   - Create and push a version tag (e.g., `v0.2.0`)
4. GitHub Actions automatically:
   - Runs all tests and checks
   - Publishes to crates.io
   - Creates GitHub release with artifacts

### Semantic Versioning

We follow [Semantic Versioning](https://semver.org/):

- **MAJOR** (x.0.0): Breaking changes that require user code updates
- **MINOR** (0.x.0): New features, backward compatible
- **PATCH** (0.0.x): Bug fixes, backward compatible

---

## ๐ŸŽฏ First-Time Contributors

Looking for something to work on? Check out issues labeled:

- [`good first issue`]https://github.com/JeetKarena/ZFish/labels/good%20first%20issue
- [`help wanted`]https://github.com/JeetKarena/ZFish/labels/help%20wanted
- [`documentation`]https://github.com/JeetKarena/ZFish/labels/documentation

### Getting Help

- ๐Ÿ’ฌ Open a [discussion]https://github.com/JeetKarena/ZFish/discussions
- ๐Ÿ› File an [issue]https://github.com/JeetKarena/ZFish/issues
- ๐Ÿ“ง Contact maintainers (see CODE_OF_CONDUCT.md)

---

## ๐Ÿ“œ License

By contributing to ZFish, you agree that your contributions will be licensed under the [MIT License](LICENSE).

---

## ๐Ÿ™ Thank You!

Your contributions make ZFish better for everyone. We appreciate your time and effort! ๐Ÿฆˆโœจ

**Happy Contributing!** ๐ŸŽ‰