Crates.io | rust-newline-converter-cli |
lib.rs | rust-newline-converter-cli |
version | 0.1.2 |
source | src |
created_at | 2020-06-07 09:15:17.839706 |
updated_at | 2022-11-09 11:59:59.823179 |
description | Newline byte converter library |
homepage | |
repository | https://github.com/spitfire05/rnc |
max_upload_size | |
id | 250912 |
size | 34,824 |
rnc
)A "dos2unix lookalike" written in Rust
The motivation to write this crate had two main pivot points:
dos2unix
being either not available or bugged on some weird platforms, like Android shellHowever, similarities to dos2unix
are in functionality only, the CLI interface was not designed to be similar to the one of dos2unix
in any way.
rnc 0.1
Newline byte(s) converter
USAGE:
rnc.exe [FLAGS] [OPTIONS] --dos2unix --unix2dos [FILE]...
FLAGS:
-f, --force Don't omit binary files
-d, --debug Print out debug info
--dos2unix Convert DOS line endings to Unix (\r\n -> \n)
-h, --help Prints help information
--unix2dos Convert Unix line endings to DOS (\n -> \r\n)
-V, --version Prints version information
-v, --verbose Be verbose about the operations
OPTIONS:
-e, --encode <ENCODE> Encode output in given encoding [possible values: utf8, utf16, utf16be]
-o, --output <OUT> Write to OUT instead of FILE or stdout. Can only be used if FILE is specified just once
ARGS:
<FILE>... Sets the input file to use. If not set, processes stdin to stdout
rnc
respects the valid newline character(s) of the input file. That means, if you use --unix2dos
and there's a lone \r
in the input buffer, it will not be converted to \r\n
, as it is not valid newline sequence.
In future there might be an option to override this behavior.
One of the main developement goals, was to achieve conversion times not worse that the ones of dos2unix
. On Linux host, the performance is roughly similar (about 0.1s difference when converting ~100MB file), while on windows rnc
is twice as fast as dos2unix
(version downloaded from https://sourceforge.net/projects/dos2unix/).
Minimum Supported Rust Version is 1.40.0
.