Skip to content

Commit bb2ae6c

Browse files
committed
docs: general clean up
1 parent 499e094 commit bb2ae6c

File tree

2 files changed

+65
-111
lines changed

2 files changed

+65
-111
lines changed

README.md

Lines changed: 13 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55
[![CI](https://github.com/lalvarezt/string_pipeline/actions/workflows/ci.yml/badge.svg)](https://github.com/lalvarezt/string_pipeline/actions)
66
[![License](https://img.shields.io/crates/l/string_pipeline.svg)](https://github.com/lalvarezt/string_pipeline/blob/main/LICENSE)
77

8-
A powerful string transformation CLI tool and Rust library that makes complex text processing simple. Transform data using intuitive **template syntax** — chain operations like **split**, **join**, **replace**, **filter**, and **20+ others** in a single readable expression.
8+
A string transformation library and CLI tool for Rust. Chain operations like split, join, replace, and filter using template syntax.
99

1010
---
1111

1212
## 📋 Table of Contents
1313

1414
- [🌟 Why String Pipeline?](#-why-string-pipeline)
15-
- [Quick Examples](#-quick-examples)
15+
- [⚡ Examples](#-examples)
1616
- [🚀 Installation](#-installation)
1717
- [🏃 Quick Start](#-quick-start)
18-
- [📚 Documentation](#-documentation)
1918
- [🧪 Testing](#-testing)
19+
- [⚡ Performance & Benchmarking](#-performance--benchmarking)
20+
- [📚 Documentation](#-documentation)
2021
- [🤝 Contributing](#-contributing)
2122
- [📄 License](#-license)
2223

@@ -41,14 +42,11 @@ string-pipeline "{split:,:..|map:{regex_extract:@(.+):1}|sort}" "john.doe@email.
4142
### ✨ Key Features
4243

4344
- **🔗 Chainable Operations**: Pipe operations together naturally
44-
- **🎯 Precise Control**: Python-like ranges with Rust syntax (`-2..`, `1..=3`)
4545
- **🗺️ Powerful Mapping**: Apply sub-pipelines to each list item
4646
- **🔍 Regex Support**: sed-like patterns for complex transformations
4747
- **🐛 Debug Mode**: Step-by-step operation visualization
48-
- **⚡ Performance Tools**: Comprehensive benchmarking and optimization
49-
- **📥 Flexible I/O**: CLI tool + embeddable Rust library
5048

51-
## Quick Examples
49+
## ⚡ Examples
5250

5351
### 🔥 Basic Transformations
5452

@@ -82,8 +80,6 @@ string-pipeline "{split: :..|filter:^[A-Z]|sort:desc}" "apple Banana cherry Date
8280
# Output: Date,Banana
8381
```
8482

85-
> 💡 **Want to see more?** Check out the [📚 Documentation](#-documentation) with 20+ operations and real-world examples!
86-
8783
## 🚀 Installation
8884

8985
### 📦 CLI Tool
@@ -118,8 +114,8 @@ string-pipeline '{template}' "input string"
118114
# With stdin
119115
echo "input" | string-pipeline '{template}'
120116

121-
# Debug mode (shows each step)
122-
string-pipeline "{!split:,:..|map:{upper}}" "hello,world"
117+
# Debug mode
118+
string-pipeline --debug "{split:,:..|map:{upper}}" "hello,world"
123119
# DEBUG: 📂 MULTI-TEMPLATE
124120
# DEBUG: ├── 🏁 MULTI-TEMPLATE START
125121
# DEBUG: ├── Template: "{!split:,:..|map:{upper}}"
@@ -193,32 +189,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
193189
}
194190
```
195191

196-
## 📚 Documentation
197-
198-
🎯 **[📖 Template System](docs/template-system.md)**
199-
200-
🔗 **[⚙️ CLI Options & Usage](docs/command-line-options.md)**
201-
202-
🐛 **[🔍 Comprehensive Debug System Guide](docs/debug-system.md)**
203-
204-
**[📊 Performance Benchmarking Guide](docs/benchmarking.md)**
205-
206-
**Everything you need to master String Pipeline:**
207-
208-
- **🏗️ Template Syntax** - Structure, chaining, escaping rules
209-
- **📊 Operations Reference** - 20+ operations with examples
210-
- 🔪 **Split & Join** - Parse and reassemble text
211-
- ✂️ **Slice & Range** - Extract with Python-like indices
212-
- 🎨 **Transform** - Case, trim, pad, append/prepend
213-
- 🔍 **Regex** - Pattern matching and replacement
214-
- 🗂️ **List Ops** - Filter, sort, unique, reverse
215-
- 🗺️ **Map** - Apply operations to each item
216-
- **🎯 Range Specifications** - Negative indexing, edge cases
217-
- **🛡️ Escaping Rules** - When and how to escape characters
218-
- **🐛 Debug Mode** - Visual operation debugging
219-
- **💡 Real-world Examples** - Data processing, log analysis, formatting
220-
- **⚠️ Troubleshooting** - Common errors and best practices
221-
222192
## 🧪 Testing
223193

224194
```bash
@@ -250,14 +220,12 @@ cargo build --release --bin bench
250220
./target/release/bench --format json > benchmark_results.json
251221
```
252222

253-
**Performance Examples:**
254-
255-
- **Fast basic operations**: 100-150ns (upper, lower, trim)
256-
- **List processing**: 3-6μs (split, join, sort)
257-
- **Complex transformations**: 10-60μs (map operations, regex)
258-
- **Release builds**: 3-10x faster than debug builds
223+
## 📚 Documentation
259224

260-
See the [📊 Performance Benchmarking Guide](docs/benchmarking.md) for timing details and measurement tips.
225+
[📖 Template System](docs/template-system.md)
226+
[⚙️ CLI Options & Usage](docs/command-line-options.md)
227+
[🔍 Comprehensive Debug System Guide](docs/debug-system.md)
228+
[📊 Performance Benchmarking Guide](docs/benchmarking.md)
261229

262230
## 🤝 Contributing
263231

@@ -267,12 +235,10 @@ We welcome contributions! 🎉
267235
- 💡 **Suggest features** or improvements
268236
- 🔧 **Submit pull requests**
269237

270-
📖 Please see our [comprehensive documentation](docs/template-system.md) for syntax details and examples.
271-
272238
## 📄 License
273239

274240
This project is licensed under the MIT License. See [LICENSE](LICENSE) for details.
275241

276242
---
277243

278-
**⚡ Fast, composable string transformations made simple!**
244+
**⚡ Fast and composable string transformations made simple!**

src/lib.rs

Lines changed: 52 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
11
//! # string_pipeline
22
//!
3-
//! A powerful string transformation CLI tool and Rust library that makes complex text processing simple.
4-
//! Transform data using intuitive **template syntax** — chain operations like **split**, **join**, **replace**,
5-
//! **filter**, and **20+ others** in a single readable expression.
3+
//! A string transformation library and CLI tool for Rust. Chain operations like split, join,
4+
//! replace, and filter using template syntax.
65
//!
76
//! ## Features
87
//!
98
//! - **🔗 Chainable Operations**: Pipe operations together naturally
10-
//! - **🎯 Precise Control**: Python-like ranges with Rust syntax (`-2..`, `1..=3`)
119
//! - **🗺️ Powerful Mapping**: Apply sub-pipelines to each list item
1210
//! - **🔍 Regex Support**: sed-like patterns for complex transformations
13-
//! - **🐛 Debug Mode**: Hierarchical operation visualization with detailed tracing
14-
//! - **📥 Flexible I/O**: CLI tool + embeddable Rust library
15-
//! - **🦀 Performance optimized**: Zero-copy operations where possible, efficient memory usage
16-
//! - **🌍 Unicode support**: Full UTF-8 and Unicode character handling
17-
//! - **🛡️ Error handling**: Comprehensive error reporting for invalid operations
11+
//! - **🐛 Debug Mode**: Step-by-step operation visualization
1812
//!
1913
//! ## Quick Start
2014
//!
@@ -110,6 +104,55 @@
110104
//! assert_eq!(result, "First: apple Second: banana");
111105
//! ```
112106
//!
107+
//! ## Type System
108+
//!
109+
//! The pipeline system has a clear type system that distinguishes between:
110+
//! - **String operations**: Work only on strings (e.g., `upper`, `lower`, `trim`, `replace`)
111+
//! - **List operations**: Work only on lists (e.g., `sort`, `unique`, `slice`)
112+
//! - **Type-preserving operations**: Accept both types (e.g., `filter`, `reverse`)
113+
//! - **Type-converting operations**: Change between types (e.g., `split` converts string→list, `join` converts list→string)
114+
//!
115+
//! Use `map:{operation}` to apply string operations to each item in a list.
116+
//!
117+
//! ## Structured Templates
118+
//!
119+
//! **Added in v0.13.0**: Apply multiple inputs to different template sections with individual separators.
120+
//! This enables powerful scenarios like batch processing, command construction, and data transformation.
121+
//!
122+
//! ```rust
123+
//! use string_pipeline::Template;
124+
//!
125+
//! // Multiple inputs per template section with different separators
126+
//! let template = Template::parse("Users: {upper} | Files: {lower}").unwrap();
127+
//! let result = template.format_with_inputs(&[
128+
//! &["john doe", "jane smith"], // Multiple users for first section
129+
//! &["FILE1.TXT", "FILE2.TXT"] // Multiple files for second section
130+
//! ], &[" ", ","]).unwrap(); // Space separator for users, comma for files
131+
//! assert_eq!(result, "Users: JOHN DOE JANE SMITH | Files: file1.txt,file2.txt");
132+
//!
133+
//! // Template introspection
134+
//! let sections = template.get_template_sections(); // Get template section info
135+
//! assert_eq!(sections.len(), 2); // Two template sections: {strip_ansi|lower} and {}
136+
//! ```
137+
//!
138+
//! ## Error Handling
139+
//!
140+
//! All operations return `Result<String, String>` for comprehensive error handling:
141+
//!
142+
//! ```rust
143+
//! use string_pipeline::Template;
144+
//!
145+
//! // Invalid template syntax
146+
//! let result = Template::parse("{split:}");
147+
//! assert!(result.is_err());
148+
//!
149+
//! // Type mismatch errors are clear and helpful
150+
//! let template = Template::parse("{sort}").unwrap();
151+
//! let result = template.format("not_a_list");
152+
//! assert!(result.is_err());
153+
//! // Error: "Sort operation can only be applied to lists"
154+
//! ```
155+
//!
113156
//! ## Common Use Cases
114157
//!
115158
//! ### Basic Text Processing
@@ -189,61 +232,6 @@
189232
//! assert_eq!(result, "app.py\ntest.py");
190233
//! ```
191234
//!
192-
//! ## Type System
193-
//!
194-
//! The pipeline system has a clear type system that distinguishes between:
195-
//! - **String operations**: Work only on strings (e.g., `upper`, `lower`, `trim`, `replace`)
196-
//! - **List operations**: Work only on lists (e.g., `sort`, `unique`, `slice`)
197-
//! - **Type-preserving operations**: Accept both types (e.g., `filter`, `reverse`)
198-
//! - **Type-converting operations**: Change between types (e.g., `split` converts string→list, `join` converts list→string)
199-
//!
200-
//! Use `map:{operation}` to apply string operations to each item in a list.
201-
//!
202-
//! ## Structured Templates (Advanced)
203-
//!
204-
//! **NEW in v0.13.0**: Apply multiple inputs to different template sections with individual separators.
205-
//! This enables powerful scenarios like batch processing, command construction, and data transformation.
206-
//!
207-
//! ```rust
208-
//! use string_pipeline::Template;
209-
//!
210-
//! // Multiple inputs per template section with different separators
211-
//! let template = Template::parse("Users: {upper} | Files: {lower}").unwrap();
212-
//! let result = template.format_with_inputs(&[
213-
//! &["john doe", "jane smith"], // Multiple users for first section
214-
//! &["FILE1.TXT", "FILE2.TXT"] // Multiple files for second section
215-
//! ], &[" ", ","]).unwrap(); // Space separator for users, comma for files
216-
//! assert_eq!(result, "Users: JOHN DOE JANE SMITH | Files: file1.txt,file2.txt");
217-
//!
218-
//! // Template introspection
219-
//! let sections = template.get_template_sections(); // Get template section info
220-
//! assert_eq!(sections.len(), 2); // Two template sections: {strip_ansi|lower} and {}
221-
//! ```
222-
//!
223-
//! **Key Features:**
224-
//! - **🎯 Flexible Input**: Each template section can receive multiple input values
225-
//! - **⚙️ Custom Separators**: Individual separator for each template section
226-
//! - **🔍 Introspection**: Examine template structure before processing
227-
//! - **🏗️ Batch Processing**: Perfect for processing multiple items per section
228-
//!
229-
//! ## Error Handling
230-
//!
231-
//! All operations return `Result<String, String>` for comprehensive error handling:
232-
//!
233-
//! ```rust
234-
//! use string_pipeline::Template;
235-
//!
236-
//! // Invalid template syntax
237-
//! let result = Template::parse("{split:}");
238-
//! assert!(result.is_err());
239-
//!
240-
//! // Type mismatch errors are clear and helpful
241-
//! let template = Template::parse("{sort}").unwrap();
242-
//! let result = template.format("not_a_list");
243-
//! assert!(result.is_err());
244-
//! // Error: "Sort operation can only be applied to lists"
245-
//! ```
246-
//!
247235
//! ## Performance Notes
248236
//!
249237
//! - Templates are compiled once and can be reused efficiently

0 commit comments

Comments
 (0)