Crates.io | line_grub |
lib.rs | line_grub |
version | 0.1.2 |
source | src |
created_at | 2022-09-29 22:11:18.068892 |
updated_at | 2022-09-29 22:28:52.037212 |
description | A command line tool deal with unfortunately long one-string files. |
homepage | https://github.com/idanmuze/line_grub |
repository | https://github.com/idanmuze/line_grub |
max_upload_size | |
id | 676949 |
size | 13,430 |
line_grub is a teeny command line tool that was created to ease the pain of dealing with unfortunately long strings. Wherever they are.
Ones like these:
A neutron star is the collapsed core of a massive supergiant star, which had a total mass of between 10 and 25 solar masses, possibly more if the star was especially metal-rich. Neutron stars are the smallest and densest stellar objects, excluding black holes and hypothetical white holes, quark stars, and strange stars.[2] Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses. They result from the supernova explosion of a massive star, combined with gravitational collapse, that compresses the core past white dwarf star density to that of atomic nuclei.
Oof...
It's super simple. Install it to your path, enter the command below and...
line_grub long_string_file.txt output.txt
You get this:
A neutron star is the collapsed core of a massive supergiant star, which had a total mass of between 10 and 25 solar masses, possibly more if the star was especially metal-rich.
Neutron stars are the smallest and densest stellar objects, excluding black holes and hypothetical white holes, quark stars, and strange stars.[2] Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses.
They result from the supernova explosion of a massive star, combined with gravitational collapse, that compresses the core past white dwarf star density to that of atomic nuclei.
A little bit better right?
If you want to add a 4 space tab at any location in your string just add "\" at any point in the string. For example:
\A neutron star is the collapsed core of a massive supergiant star, which had a total mass of between 10 and 25 solar masses, possibly more if the star was especially metal-rich. Neutron stars are the smallest and densest stellar objects, excluding black holes and hypothetical white holes, quark stars, and strange stars.[2] Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses.
And you get this!:
A neutron star is the collapsed core of a massive supergiant star, which had a total mass of between 10 and 25 solar masses, possibly more if the star was especially metal-rich.
Neutron stars are the smallest and densest stellar objects, excluding black holes and hypothetical white holes, quark stars, and strange stars.[2] Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses.
Most text editors do have great word-wrapping. So in many cases, you'll be fine without this tbh. But for those times when you're purely on the command line, it can come in handy! It's also helpful for debugging.
line_grub is available on crates.io. The way to use it is as of now is to get it through Cargo. I will add excutables very soon.
cargo install line_grub
line_grub currently requires rustc 1.46.0
or greater.
line_grub is an open source project that is extremely new! Note that all code submitted in PRs to line_grub is assumed to be licensed under line_grub's dual MIT/Apache2 licensing.
line_grub is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See LICENSE-APACHE and LICENSE-MIT for details. Opening a pull request is assumed to signal agreement with these licensing terms.