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:
parent
2f658b0604
commit
ca77e33664
4 changed files with 33 additions and 14 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
|
@ -89,9 +89,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.5.57"
|
version = "4.5.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6899ea499e3fb9305a65d5ebf6e3d2248c5fab291f300ad0a704fbe142eae31a"
|
checksum = "63be97961acde393029492ce0be7a1af7e323e6bae9511ebfac33751be5e6806"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap_builder",
|
"clap_builder",
|
||||||
"clap_derive",
|
"clap_derive",
|
||||||
|
|
@ -99,9 +99,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_builder"
|
name = "clap_builder"
|
||||||
version = "4.5.57"
|
version = "4.5.58"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7b12c8b680195a62a8364d16b8447b01b6c2c8f9aaf68bee653be34d4245e238"
|
checksum = "7f13174bda5dfd69d7e947827e5af4b0f2f94a4a3ee92912fba07a66150f21e2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anstream",
|
"anstream",
|
||||||
"anstyle",
|
"anstyle",
|
||||||
|
|
@ -123,9 +123,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap_lex"
|
name = "clap_lex"
|
||||||
version = "0.7.7"
|
version = "1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c3e64b0cc0439b12df2fa678eae89a1c56a529fd067a9115f7827f1fffd22b32"
|
checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "colorchoice"
|
name = "colorchoice"
|
||||||
|
|
@ -144,7 +144,7 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "dolltool"
|
name = "dolltool"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clap",
|
"clap",
|
||||||
"num-bigint",
|
"num-bigint",
|
||||||
|
|
@ -237,9 +237,9 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.180"
|
version = "0.2.181"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"
|
checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
license = "GPL-3.0-or-later"
|
license = "GPL-3.0-or-later"
|
||||||
name = "dolltool"
|
name = "dolltool"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
authors = ["ika4422"]
|
authors = ["ika4422"]
|
||||||
description = "A simple dollcode encoder, decoder, and generator inside your terminal :3"
|
description = "A simple dollcode encoder, decoder, and generator inside your terminal :3"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
|
||||||
22
README.md
22
README.md
|
|
@ -28,27 +28,43 @@ execute anywhere from inside your terminal you must add `~/.cargo/bin` to your p
|
||||||
|
|
||||||
### Encoding
|
### 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
|
```bash
|
||||||
$ dolltool -e 123
|
$ 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
|
```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
|
### Decoding
|
||||||
|
|
||||||
|
This works the same for both integers and text:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ dolltool -d ▖▖▖▖▌
|
$ dolltool -d ▖▖▖▖▌
|
||||||
123
|
123
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cargo run --release -- -d "▌▘▖▘ ▌▖▌▘ ▌▘▘▌ ▌▘▘▌
|
||||||
|
▌▘▌▌ ▌▖▘ ▌▌▌▘ ▌▘▌▌ ▌▌▖▌ ▌▘▘▌ ▌▖▌▖ ▌▖▘ ▖▌▖▖ ▖▘▖▌"
|
||||||
|
hello world :3
|
||||||
|
```
|
||||||
|
|
||||||
### Generation
|
### Generation
|
||||||
|
|
||||||
Generates random codes based on a user-defined pattern:
|
Generates random codes based on a user-defined pattern:
|
||||||
|
|
|
||||||
|
|
@ -118,8 +118,11 @@ fn main() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if let Some(input) = args.decode {
|
} 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();
|
let mut decoded_chars = String::new();
|
||||||
|
|
||||||
for part in input.split_whitespace() {
|
for part in input.split_whitespace() {
|
||||||
match from_dollcode(part) {
|
match from_dollcode(part) {
|
||||||
Ok(val) => {
|
Ok(val) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue