Skip to content

Commit

Permalink
#6: Support all Characters from Up-Stream (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylhack committed Aug 21, 2023
1 parent 3c35bdc commit 66eea25
Show file tree
Hide file tree
Showing 28 changed files with 1,096 additions and 54 deletions.
31 changes: 5 additions & 26 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,9 @@
// README at: https://github.com/devcontainers/templates/tree/main/src/rust
{
"name": "Cowsay Bot",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye"

// Use 'mounts' to make the cargo cache persistent in a Docker Volume.
// "mounts": [
// {
// "source": "devcontainer-cargo-cache-${devcontainerId}",
// "target": "/usr/local/cargo",
// "type": "volume"
// }
// ]

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "rustc --version",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/dhoeric/features/act:1": {}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
- name: Build
run: cargo build --verbose
- name: Test
run: cargo test
run: bash scripts/test.sh
20 changes: 15 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ edition = "2021"
[dependencies]
ansi_colours = "1.2.2"
charasay = "3.0.1"
imageproc = "0.23.0"
rand = "0.8.5"
rusttype = "0.9.3"

[dependencies.cowparse]
path = "./cowparse"
features = ["images"]

[dependencies.image]
version = "0.24.6"
version = "0.24.7"
default-features = false
features = ["webp", "webp-encoder"]

Expand Down
3 changes: 3 additions & 0 deletions cowparse/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target
/Cargo.lock
output.png
31 changes: 31 additions & 0 deletions cowparse/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[package]
name = "cowparse"
version = "0.1.0"
edition = "2021"
license = "MIT"
homepage = "https://cowsay.app"
repository = "https://github.com/dylhack/cowparse"
description = "A library for parsing cowsay files."

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ansi_colours = "1.2.2"
imageproc = { version = "0.23.0", optional = true }
rusttype = { version = "0.9.3", optional = true }

[dependencies.image]
version = "0.24.7"
optional = true
default-features = false

[dev-dependencies]
charasay = "3.0.1"

[dev-dependencies.image]
version = "0.24.7"
default-features = false
features = ["png"]

[features]
default = []
images = ["image", "imageproc", "rusttype"]
21 changes: 21 additions & 0 deletions cowparse/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Dylan Hackworth

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions cowparse/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
At a high level this is an ANSI X3.64 SGR parser.
12 changes: 12 additions & 0 deletions cowparse/src/ansi.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
mod parse;
/// A collection of constants from X3.64, ISO 6429, ECMA-48, and T.416.
///
/// - [X3.64](https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub86.pdf)
/// - [ISO 6429](https://www.iso.org/standard/12782.html)
/// - [ECMA-48](https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf)
/// - [T.416](https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-T.416-199303-I!!PDF-E&type=items)
pub mod sgr;
pub mod types;
mod util;
pub use self::types::{ANSIChar, ANSIString};
pub use parse::parse;

0 comments on commit 66eea25

Please sign in to comment.