1.3.0 :: implemented the text autodetection for decoding which should have been present in 1.1.0 however wasn't because i forgor, also updated the README to reflect changes in encoding and decoding text

This commit is contained in:
ika4422 2026-02-11 20:32:14 +00:00
parent 2f658b0604
commit ca77e33664
No known key found for this signature in database
4 changed files with 33 additions and 14 deletions

18
Cargo.lock generated
View file

@ -89,9 +89,9 @@ dependencies = [
[[package]]
name = "clap"
version = "4.5.57"
version = "4.5.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a"
checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806"
dependencies = [
"clap_builder",
"clap_derive",
@ -99,9 +99,9 @@ dependencies = [
[[package]]
name = "clap_builder"
version = "4.5.57"
version = "4.5.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238"
checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2"
dependencies = [
"anstream",
"anstyle",
@ -123,9 +123,9 @@ dependencies = [
[[package]]
name = "clap_lex"
version = "0.7.7"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
[[package]]
name = "colorchoice"
@ -144,7 +144,7 @@ dependencies = [
[[package]]
name = "dolltool"
version = "1.2.0"
version = "1.3.0"
dependencies = [
"clap",
"num-bigint",
@ -237,9 +237,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "libc"
version = "0.2.180"
version = "0.2.181"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"
[[package]]
name = "log"

View file

@ -1,7 +1,7 @@
[package]
license = "GPL-3.0-or-later"
name = "dolltool"
version = "1.2.0"
version = "1.3.0"
authors = ["ika4422"]
description = "A simple dollcode encoder, decoder, and generator inside your terminal :3"
edition = "2024"

View file

@ -28,27 +28,43 @@ execute anywhere from inside your terminal you must add `~/.cargo/bin` to your p
### Encoding
By default, dolltool treats inputs as integers:
If an integer is passed to encode it will by default be encoded as an integer:
```bash
$ dolltool -e 123
▖▖▖▖▌
```
To encode a string you simply add the text flag `-t` (or `--text`):
If you would like to encode an integer as text instead you must pass the `-t`
(`--text`) argument:
```bash
$ dolltool -e "hello world :3" -t
$ dolltool -e 123 -t
▖▘▖▖ ▖▘▖▘ ▖▘▖▌
```
Finally, any non-integer patterns will automatically be encoded as text:
```bash
$ dolltool -e "hello world :3"
▌▘▖▘ ▌▖▌▘ ▌▘▘▌ ▌▘▘▌ ▌▘▌▌ ▌▖▘ ▌▌▌▘ ▌▘▌▌ ▌▌▖▌ ▌▘▘▌ ▌▖▌▖ ▌▖▘ ▖▌▖▖ ▖▘▖▌
```
### Decoding
This works the same for both integers and text:
```bash
$ dolltool -d ▖▖▖▖▌
123
```
```bash
$ cargo run --release -- -d "▌▘▖▘ ▌▖▌▘ ▌▘▘▌ ▌▘▘▌
▌▘▌▌ ▌▖▘ ▌▌▌▘ ▌▘▌▌ ▌▌▖▌ ▌▘▘▌ ▌▖▌▖ ▌▖▘ ▖▌▖▖ ▖▘▖▌"
hello world :3
```
### Generation
Generates random codes based on a user-defined pattern:

View file

@ -118,8 +118,11 @@ fn main() {
}
}
} else if let Some(input) = args.decode {
if args.text {
let decode_as_text = args.text || input.split_whitespace().count() > 1;
if decode_as_text {
let mut decoded_chars = String::new();
for part in input.split_whitespace() {
match from_dollcode(part) {
Ok(val) => {