Skip to content

Commit

Permalink
Add "sus" pipe kind (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
lhvy authored Jul 25, 2022
1 parent fbced0f commit 6b703a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ color_mode = "ansi" # ansi, rgb or none
palette = "default" # default, darker, pastel or matrix
delay_ms = 20
inherit_style = false
kinds = ["heavy"] # heavy, light, curved, knobby, emoji, outline, dots, blocks
kinds = ["heavy"] # heavy, light, curved, knobby, emoji, outline, dots, blocks, sus
num_pipes = 1
reset_threshold = 0.5 # 0.0–1.0
turn_chance = 0.15 # 0.0–1.0
Expand Down Expand Up @@ -86,6 +86,7 @@ turn_chance = 0.15 # 0.0–1.0
| `outline` | `║ ║ ═ ═ ╔ ╗ ╚ ╝` |
| `dots` | `• • • • • • • •` |
| `blocks` | `█ █ ▀ ▀ █ █ ▀ ▀` |
| `sus` | `ඞ ඞ ඞ ඞ ඞ ඞ ඞ ඞ` |

_Due to emojis having a different character width, using the emoji pipe kind along side another pipe kind can cause spacing issues._

Expand All @@ -100,7 +101,7 @@ There are also command line options that can be used to override parts of the co
| `-d` | sets the delay in ms | `-d 15` |
| `-i` | toggles if pipes inherit style when hitting the edge | `-i false` |
| `-k` | sets the kinds of pipes, each kind separated by commas | `-k heavy,curved` |
| `-p` | sets the number of pipes onscreen | `-p 5` |
| `-p` | sets the number of pipes on screen | `-p 5` |
| `-r` | sets the percentage of the screen to be filled before resetting | `-r 0.75` |
| `-t` | chance of a pipe turning each frame | `-t 0.15` |
| `--palette` | sets the color palette, RGB mode only | `--palette pastel` |
Expand All @@ -109,7 +110,7 @@ There are also command line options that can be used to override parts of the co

### Contributors

pipes-rs is maintained by [lhvy](https://github.com/lhvy) and [arzg](https://github.com/arzg); any other contributions via PRs are welcome! Forks and modifications are implicitly dual-licensed under Apache 2.0 OR MIT. Please credit the above contributers and pipes.sh when making modifications.
pipes-rs is maintained by [lhvy](https://github.com/lhvy) and [arzg](https://github.com/arzg); any other contributions via PRs are welcome! Forks and modifications are implicitly dual-licensed under Apache 2.0 OR MIT. Please credit the above contributors and pipes.sh when making modifications.

### Inspiration

Expand Down
8 changes: 6 additions & 2 deletions crates/model/src/pipe/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pub enum Kind {
Outline,
Dots,
Blocks,
Sus,
}

impl Kind {
Expand Down Expand Up @@ -57,12 +58,13 @@ impl Kind {
Self::Outline => Self::OUTLINE,
Self::Dots => Self::DOTS,
Self::Blocks => Self::BLOCKS,
Self::Sus => Self::SUS,
}
}

fn width(self) -> KindWidth {
match self {
Self::Dots => KindWidth::Custom(NonZeroUsize::new(2).unwrap()),
Self::Dots | Self::Sus => KindWidth::Custom(NonZeroUsize::new(2).unwrap()),
_ => KindWidth::Auto,
}
}
Expand All @@ -75,6 +77,7 @@ impl Kind {
const OUTLINE: [char; 8] = ['║', '║', '═', '═', '╔', '╗', '╚', '╝'];
const DOTS: [char; 8] = ['•', '•', '•', '•', '•', '•', '•', '•'];
const BLOCKS: [char; 8] = ['█', '█', '▀', '▀', '█', '█', '▀', '▀'];
const SUS: [char; 8] = ['ඞ', 'ඞ', 'ඞ', 'ඞ', 'ඞ', 'ඞ', 'ඞ', 'ඞ'];
}

#[derive(Clone, Copy)]
Expand All @@ -96,8 +99,9 @@ impl FromStr for Kind {
"outline" => Self::Outline,
"dots" => Self::Dots,
"blocks" => Self::Blocks,
"sus" => Self::Sus,
_ => anyhow::bail!(
r#"unknown pipe kind (expected “heavy”, “light”, “curved”, “knobby”, “emoji”, “outline”, “dots” or “blocks”)"#,
r#"unknown pipe kind (expected “heavy”, “light”, “curved”, “knobby”, “emoji”, “outline”, “dots”, “blocks”, or “sus”)"#,
),
})
}
Expand Down

0 comments on commit 6b703a8

Please sign in to comment.