feat: add mise and license
This commit is contained in:
48
README.md
Normal file
48
README.md
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# fexcel
|
||||||
|
|
||||||
|
A simple command-line tool to sanitize invalid UTF-8 sequences from input streams.
|
||||||
|
|
||||||
|
## Overview
|
||||||
|
|
||||||
|
`fexcel` reads data from stdin, replaces any invalid UTF-8 sequences with the Unicode replacement character (<28>), and writes the sanitized output to stdout. This is particularly useful when working with files that may contain mixed or invalid encodings, such as Windows-exported CSV files.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mise run install # or
|
||||||
|
cargo install --path . --force
|
||||||
|
```
|
||||||
|
|
||||||
|
Or build from source:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo build --release
|
||||||
|
```
|
||||||
|
|
||||||
|
The binary will be available at `target/release/fexcel`.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Use `fexcel` as a pipe filter to clean input before passing it to tools that require valid UTF-8:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat my-windows-exported.csv | fexcel | csvlens
|
||||||
|
```
|
||||||
|
|
||||||
|
Without `fexcel`, tools like `csvlens` may fail with invalid UTF-8 errors. By piping through `fexcel` first, you can safely view and process files with encoding issues.
|
||||||
|
|
||||||
|
### Additional Examples
|
||||||
|
|
||||||
|
Clean a file and save the output:
|
||||||
|
```bash
|
||||||
|
cat problematic-file.txt | fexcel > cleaned-file.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
Use with any UTF-8 sensitive tool:
|
||||||
|
```bash
|
||||||
|
cat messy-data.log | fexcel | grep "pattern"
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
See LICENSE file for details.
|
||||||
6
mise.toml
Normal file
6
mise.toml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[tools]
|
||||||
|
rust = { version = "1.91", components = "rust-src" }
|
||||||
|
cargo = "latest"
|
||||||
|
|
||||||
|
[tasks.install]
|
||||||
|
run = "cargo install --path . --force"
|
||||||
@@ -1,3 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
* "THE BEER-WARE LICENSE" (Revision 42):
|
||||||
|
* <contact@kjuulh.io> wrote this file. As long as you retain this notice you
|
||||||
|
* can do whatever you want with this stuff. If we meet some day, and you think
|
||||||
|
* this stuff is worth it, you can buy me a beer in return Kasper J. Hermansen
|
||||||
|
* ----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
use anyhow::Context;
|
use anyhow::Context;
|
||||||
|
|||||||
Reference in New Issue
Block a user