Skip to content

Commit de2ef28

Browse files
authored
docs: added crate information
1 parent 4385840 commit de2ef28

File tree

1 file changed

+26
-40
lines changed

1 file changed

+26
-40
lines changed

README.md

Lines changed: 26 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
# String Template Processor
22

3+
[![Crates.io](https://img.shields.io/crates/v/string_pipeline.svg)](https://crates.io/crates/string_pipeline)
4+
[![Docs.rs](https://docs.rs/string_pipeline/badge.svg)](https://docs.rs/string_pipeline)
5+
[![CI](https://github.com/lalvarezt/string_pipeline/actions/workflows/release.yml/badge.svg)](https://github.com/lalvarezt/string_pipeline/actions)
6+
[![License](https://img.shields.io/crates/l/string_pipeline.svg)](https://github.com/lalvarezt/string_pipeline/blob/main/LICENSE)
7+
8+
---
9+
310
A flexible, composable string transformation CLI tool and library for Rust originally created as a parser for [television](https://github.com/alexpasmantier/television). It allows you to chain operations like split, join, slice, replace, case conversion, trim, and more, using a concise template syntax.
411

12+
## Use Cases
13+
14+
- **Data extraction**: Parse CSV, logs, or structured text
15+
- **Text transformation**: Clean and format strings in pipelines
16+
- **File processing**: Extract parts of filenames or paths
17+
- **Configuration parsing**: Process environment variables or config files
18+
- **Shell scripting**: Quick text manipulation in scripts
19+
520
## Features
621

722
- **Composable operations**: Chain multiple string operations in a single template.
@@ -16,7 +31,17 @@ A flexible, composable string transformation CLI tool and library for Rust origi
1631
- **Stdin support**: Read input from stdin when no input argument is provided.
1732
- **Tested**: Comprehensive test suite.
1833

19-
## Usage
34+
## 📦 Crate
35+
36+
You can find this crate on [crates.io](https://crates.io/crates/string_pipeline):
37+
38+
```toml
39+
[dependencies]
40+
string_pipeline = "0.3.0"
41+
```
42+
43+
## 🚀 Usage
44+
2045

2146
### As a CLI
2247

@@ -139,33 +164,6 @@ echo "2023-01-01 ERROR Failed to connect" | cargo run -- "{split: :1..:join: :lo
139164
# Output: error failed to connect
140165
```
141166

142-
## Library Usage
143-
144-
Add to your `Cargo.toml`:
145-
146-
```toml
147-
[dependencies]
148-
clap = "4"
149-
regex = "1"
150-
```
151-
152-
Use in your code:
153-
154-
```rust
155-
use your_crate::process;
156-
157-
let result = process("foo,bar,baz", "{split:,:1:upper}").unwrap();
158-
assert_eq!(result, "BAR");
159-
160-
// Chain multiple operations
161-
let result = process(" hello world ", "{trim:split: :join:_:upper}").unwrap();
162-
assert_eq!(result, "HELLO_WORLD");
163-
164-
// Work with ranges
165-
let result = process("a,b,c,d,e", "{split:,:1..=3:join:-}").unwrap();
166-
assert_eq!(result, "b-c-d");
167-
```
168-
169167
## Error Handling
170168

171169
The tool provides helpful error messages for common issues:
@@ -190,18 +188,6 @@ cargo run -- "{replace:s/[/replacement/}" "test"
190188
cargo test
191189
```
192190

193-
## Use Cases
194-
195-
- **Data extraction**: Parse CSV, logs, or structured text
196-
- **Text transformation**: Clean and format strings in pipelines
197-
- **File processing**: Extract parts of filenames or paths
198-
- **Configuration parsing**: Process environment variables or config files
199-
- **Shell scripting**: Quick text manipulation in scripts
200-
201-
## License
202-
203-
MIT
204-
205191
---
206192

207193
**Enjoy fast, composable string transformations!**

0 commit comments

Comments
 (0)