Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
715fa605a6 | |||
a161aab0ca | |||
a62316c9f5 | |||
d41df133b1 | |||
9bf53f1d27 | |||
b91056d68a | |||
ad7fc4e0cd | |||
0773529ba5 | |||
90e5eb8f79 | |||
9bac43bf5d | |||
0670e3796c | |||
0236f702b4 | |||
05e1bd48e0 |
8 changed files with 164 additions and 125 deletions
|
@ -1,11 +1,11 @@
|
|||
[package]
|
||||
name = "pride"
|
||||
version = "0.4.1"
|
||||
version = "0.4.3"
|
||||
edition = "2021"
|
||||
authors = [ "Valerie Wolfe <sleeplessval@gmail.com>" ]
|
||||
description = "Pride flags in the terminal."
|
||||
homepage = "https://git.vwolfe.io/valerie/pride"
|
||||
repository = "https://git.vwolfe.io/valerie/pride"
|
||||
homepage = "https://git.sleeplessval.io/valerie/pride"
|
||||
repository = "https://git.sleeplessval.io/valerie/pride"
|
||||
license = "MIT"
|
||||
categories = [ "command-line-utilities" ]
|
||||
keywords = [ "lgbt", "pride", "cli" ]
|
||||
|
@ -19,8 +19,9 @@ name = "pride"
|
|||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
oorandom = '11.1.4'
|
||||
pico-args = "0.5.0"
|
||||
termion = "3.0.0"
|
||||
termion = "4.0.3"
|
||||
|
||||
[profile.release]
|
||||
opt-level = 's'
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
A Rust utility to display pride flags in the terminal.
|
||||
|
||||
A list of currently implemented flags is available on the [project wiki](https://git.vwolfe.io/valerie/pride/wiki/Flags).
|
||||
A list of currently implemented flags is available on the [project wiki](https://git.sleeplessval.io/valerie/pride/wiki/Flags).
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
@ -16,7 +16,7 @@ slant symbols, and therefore require use of a Powerline font, such as [Fira Code
|
|||
|
||||
<details>
|
||||
<summary>Release Binary</summary>
|
||||
Copy the compiled binary from the <a href="https://git.vwolfe.io/valerie/pride/releases/">releases page</a>
|
||||
Copy the compiled binary from the <a href="https://git.sleeplessval.io/valerie/pride/releases/">releases page</a>
|
||||
to a directory in <code>$PATH</code>, such as <code>/usr/bin/</code>.
|
||||
</details>
|
||||
|
||||
|
|
13
man/pride.6
13
man/pride.6
|
@ -55,7 +55,7 @@ The 5-stripe lesbian pride flag designed by Emily Gwen in 2018.
|
|||
.Pp
|
||||
VARIANTS
|
||||
.Bl -tag -width Ds -compact
|
||||
.It Ic 7-color
|
||||
.It Ic 7, 7-color, 7-stripe
|
||||
The 7-stripe lesbian pride flag designed by Emily Gwen in 2018.
|
||||
.El
|
||||
.It Ic multisexual, m-spec, mspec
|
||||
|
@ -82,6 +82,17 @@ The rainbow flag designed for 2017 Philadelphia Pride.
|
|||
.It Ic transgender, trans
|
||||
The transgender pride flag designed by Monica Helms in 1999.
|
||||
.El
|
||||
.Sh ENVIRONMENT
|
||||
.Bl -tag -width Ds
|
||||
.It PRIDE_DEFAULT
|
||||
A string containing the name of one or more flags to use as the default when no
|
||||
.Ar flag
|
||||
argument is provided. If the string contains a semicolon-separated list of flags, a random one will be selected from the list. If a space is found in the chosen substring, it will be used to provide the
|
||||
.Ar flag
|
||||
and
|
||||
.Ar variant
|
||||
arguments.
|
||||
.El
|
||||
.Sh EXIT STATUS
|
||||
.Bl -tag -width Ds
|
||||
.It 1
|
||||
|
|
212
sbom.xml
212
sbom.xml
|
@ -1,13 +1,13 @@
|
|||
{
|
||||
"SPDXID": "SPDXRef-DOCUMENT",
|
||||
"creationInfo": {
|
||||
"created": "2024-07-05T20:16:51.403Z",
|
||||
"created": "2024-12-13T16:02:17.260Z",
|
||||
"creators": [
|
||||
"Tool: cargo-sbom-v0.8.4"
|
||||
]
|
||||
},
|
||||
"dataLicense": "CC0-1.0",
|
||||
"documentNamespace": "https://spdx.org/spdxdocs/pride-6150510e-b518-43f0-aa53-3e2795909cc2",
|
||||
"documentNamespace": "https://spdx.org/spdxdocs/pride-93ad73c9-b337-4ad0-bd63-92e9b7d1a2d8",
|
||||
"files": [
|
||||
{
|
||||
"SPDXID": "SPDXRef-File-pride",
|
||||
|
@ -21,70 +21,62 @@
|
|||
"name": "pride",
|
||||
"packages": [
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-redox_syscall-0.4.1",
|
||||
"SPDXID": "SPDXRef-Package-oorandom-11.1.4",
|
||||
"description": "A tiny, robust PRNG implementation.",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/oorandom@11.1.4",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "oorandom",
|
||||
"versionInfo": "11.1.4"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-redox_syscall-0.5.7",
|
||||
"description": "A Rust library to access raw Redox system calls",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/redox_syscall@0.4.1",
|
||||
"referenceLocator": "pkg:cargo/redox_syscall@0.5.7",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "redox_syscall",
|
||||
"versionInfo": "0.4.1"
|
||||
"versionInfo": "0.5.7"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-libredox-0.0.2",
|
||||
"description": "Redox stable ABI",
|
||||
"SPDXID": "SPDXRef-Package-pride-0.4.3",
|
||||
"description": "Pride flags in the terminal.",
|
||||
"downloadLocation": "NONE",
|
||||
"homepage": "https://git.sleeplessval.io/valerie/pride",
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "pride",
|
||||
"versionInfo": "0.4.3"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-termion-4.0.3",
|
||||
"description": "A bindless library for manipulating terminals.",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/libredox@0.0.2",
|
||||
"referenceLocator": "pkg:cargo/termion@4.0.3",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "libredox",
|
||||
"versionInfo": "0.0.2"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-libc-0.2.155",
|
||||
"description": "Raw FFI bindings to platform libraries like libc.\n",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/libc@0.2.155",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/rust-lang/libc",
|
||||
"licenseConcluded": "MIT OR Apache-2.0",
|
||||
"licenseDeclared": "MIT OR Apache-2.0",
|
||||
"name": "libc",
|
||||
"versionInfo": "0.2.155"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-bitflags-1.3.2",
|
||||
"description": "A macro to generate structures which behave like bitflags.\n",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/bitflags@1.3.2",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/bitflags/bitflags",
|
||||
"licenseConcluded": "MIT OR Apache-2.0",
|
||||
"licenseDeclared": "MIT/Apache-2.0",
|
||||
"name": "bitflags",
|
||||
"versionInfo": "1.3.2"
|
||||
"name": "termion",
|
||||
"versionInfo": "4.0.3"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-redox_termios-0.1.3",
|
||||
|
@ -103,45 +95,30 @@
|
|||
"versionInfo": "0.1.3"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-numtoa-0.1.0",
|
||||
"description": "Convert numbers into stack-allocated byte arrays",
|
||||
"SPDXID": "SPDXRef-Package-libc-0.2.167",
|
||||
"description": "Raw FFI bindings to platform libraries like libc.\n",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/numtoa@0.1.0",
|
||||
"referenceLocator": "pkg:cargo/libc@0.2.167",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"homepage": "https://github.com/rust-lang/libc",
|
||||
"licenseConcluded": "MIT OR Apache-2.0",
|
||||
"licenseDeclared": "MIT OR Apache-2.0",
|
||||
"name": "numtoa",
|
||||
"versionInfo": "0.1.0"
|
||||
"name": "libc",
|
||||
"versionInfo": "0.2.167"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-termion-3.0.0",
|
||||
"description": "A bindless library for manipulating terminals.",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/termion@3.0.0",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "termion",
|
||||
"versionInfo": "3.0.0"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-bitflags-2.5.0",
|
||||
"SPDXID": "SPDXRef-Package-bitflags-2.6.0",
|
||||
"description": "A macro to generate structures which behave like bitflags.\n",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/bitflags@2.5.0",
|
||||
"referenceLocator": "pkg:cargo/bitflags@2.6.0",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
|
@ -149,17 +126,39 @@
|
|||
"licenseConcluded": "MIT OR Apache-2.0",
|
||||
"licenseDeclared": "MIT OR Apache-2.0",
|
||||
"name": "bitflags",
|
||||
"versionInfo": "2.5.0"
|
||||
"versionInfo": "2.6.0"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pride-0.4.1",
|
||||
"description": "Pride flags in the terminal.",
|
||||
"downloadLocation": "NONE",
|
||||
"homepage": "https://git.vwolfe.io/valerie/pride",
|
||||
"SPDXID": "SPDXRef-Package-libredox-0.1.3",
|
||||
"description": "Redox stable ABI",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/libredox@0.1.3",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT",
|
||||
"licenseDeclared": "MIT",
|
||||
"name": "pride",
|
||||
"versionInfo": "0.4.1"
|
||||
"name": "libredox",
|
||||
"versionInfo": "0.1.3"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-numtoa-0.2.4",
|
||||
"description": "Convert numbers into stack-allocated byte arrays",
|
||||
"downloadLocation": "registry+https://github.com/rust-lang/crates.io-index",
|
||||
"externalRefs": [
|
||||
{
|
||||
"referenceCategory": "PACKAGE-MANAGER",
|
||||
"referenceLocator": "pkg:cargo/numtoa@0.2.4",
|
||||
"referenceType": "purl"
|
||||
}
|
||||
],
|
||||
"licenseConcluded": "MIT OR Apache-2.0",
|
||||
"licenseDeclared": "MIT OR Apache-2.0",
|
||||
"name": "numtoa",
|
||||
"versionInfo": "0.2.4"
|
||||
},
|
||||
{
|
||||
"SPDXID": "SPDXRef-Package-pico-args-0.5.0",
|
||||
|
@ -180,59 +179,64 @@
|
|||
],
|
||||
"relationships": [
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-numtoa-0.1.0",
|
||||
"relatedSpdxElement": "SPDXRef-Package-redox_termios-0.1.3",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-termion-3.0.0"
|
||||
"spdxElementId": "SPDXRef-Package-termion-4.0.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-pico-args-0.5.0",
|
||||
"relatedSpdxElement": "SPDXRef-Package-libc-0.2.167",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-pride-0.4.1"
|
||||
"spdxElementId": "SPDXRef-Package-termion-4.0.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-libc-0.2.155",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-termion-3.0.0"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-termion-3.0.0",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-pride-0.4.1"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-bitflags-1.3.2",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-redox_syscall-0.4.1"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-pride-0.4.1",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pride-0.4.3",
|
||||
"relationshipType": "GENERATED_FROM",
|
||||
"spdxElementId": "SPDXRef-File-pride"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-libredox-0.0.2",
|
||||
"relatedSpdxElement": "SPDXRef-Package-bitflags-2.6.0",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-termion-3.0.0"
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.1.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-redox_syscall-0.4.1",
|
||||
"relatedSpdxElement": "SPDXRef-Package-libc-0.2.167",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.0.2"
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.1.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-redox_termios-0.1.3",
|
||||
"relatedSpdxElement": "SPDXRef-Package-libredox-0.1.3",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-termion-3.0.0"
|
||||
"spdxElementId": "SPDXRef-Package-termion-4.0.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-libc-0.2.155",
|
||||
"relatedSpdxElement": "SPDXRef-Package-pico-args-0.5.0",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.0.2"
|
||||
"spdxElementId": "SPDXRef-Package-pride-0.4.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-bitflags-2.5.0",
|
||||
"relatedSpdxElement": "SPDXRef-Package-termion-4.0.3",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.0.2"
|
||||
"spdxElementId": "SPDXRef-Package-pride-0.4.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-redox_syscall-0.5.7",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-libredox-0.1.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-numtoa-0.2.4",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-termion-4.0.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-oorandom-11.1.4",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-pride-0.4.3"
|
||||
},
|
||||
{
|
||||
"relatedSpdxElement": "SPDXRef-Package-bitflags-2.6.0",
|
||||
"relationshipType": "DEPENDS_ON",
|
||||
"spdxElementId": "SPDXRef-Package-redox_syscall-0.5.7"
|
||||
}
|
||||
],
|
||||
"spdxVersion": "SPDX-2.3"
|
||||
|
|
|
@ -118,7 +118,7 @@ impl Flag {
|
|||
Flag::Stripes(colors)
|
||||
=> {
|
||||
let count = colors.len() as u16;
|
||||
let (width, height) = state.size.get(count * 3, count);
|
||||
let (width, height) = state.size.get((count * 20 + 3) / 6, count);
|
||||
if height < count { error::too_small(width, height); }
|
||||
fg_stripes(colors, width, height)
|
||||
},
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
use std::process::exit;
|
||||
|
||||
pub fn unmatched_flag(target: String) {
|
||||
println!("pride: no flag {target}");
|
||||
eprintln!("pride: no flag {target}");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
pub fn size_missing() {
|
||||
println!("pride: size flag requires a value");
|
||||
eprintln!("pride: size flag requires a value");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
pub fn size_error(value: &str) {
|
||||
println!("pride: size '{value}' is invalid");
|
||||
eprintln!("pride: size '{value}' is invalid");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
pub fn too_small(width: u16, height: u16) {
|
||||
println!("pride: this flag must be bigger than {width}x{height}");
|
||||
eprintln!("pride: this flag must be bigger than {width}x{height}");
|
||||
exit(3);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ names:
|
|||
=> { println!("The gender-nonconforming pride flag.\n\nnames:\n 'gender-nonconforming', 'gendernonconforming', 'gnc'"); },
|
||||
|
||||
|
||||
"lesbian"
|
||||
"lesbian" | "wlw"
|
||||
=> {
|
||||
println!("The 5-stripe lesbian flag designed by Emily Gwen in 2018.
|
||||
|
||||
|
@ -138,7 +138,9 @@ names:
|
|||
'lesbian', 'wlw'
|
||||
|
||||
variants:
|
||||
7-color 7-stripe flag, also designed in 2018 by Emily Gwen");
|
||||
7 7-stripe flag, also designed in 2018 by Emily Gwen
|
||||
7-color
|
||||
7-stripe");
|
||||
},
|
||||
|
||||
|
||||
|
|
35
src/main.rs
35
src/main.rs
|
@ -1,4 +1,8 @@
|
|||
//! main method module
|
||||
use std::{
|
||||
env::var,
|
||||
time::UNIX_EPOCH
|
||||
};
|
||||
|
||||
use pico_args::Arguments;
|
||||
|
||||
|
@ -19,10 +23,10 @@ use crate::{
|
|||
|
||||
static VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
pub const FLAG_HELP: [&str;2] = [ "-h", "--help" ];
|
||||
pub const FLAG_LIST: [&str;2] = [ "-l", "--list" ];
|
||||
pub const FLAG_SIZE: [&str;2] = [ "-s", "--size"];
|
||||
pub const FLAG_VERSION: [&str;2] = [ "-v", "--version" ];
|
||||
pub const FLAG_HELP: [&str;2] = [ "-h", "--help" ];
|
||||
pub const FLAG_LIST: [&str;2] = [ "-l", "--list" ];
|
||||
pub const FLAG_SIZE: [&str;2] = [ "-s", "--size" ];
|
||||
pub const FLAG_VERSION: [&str;2] = [ "-v", "--version" ];
|
||||
|
||||
fn main() {
|
||||
// collect args
|
||||
|
@ -50,8 +54,25 @@ fn main() {
|
|||
|
||||
let state = State::new(&mut args);
|
||||
|
||||
let subcommand = args.subcommand().unwrap();
|
||||
let variant = args.subcommand().unwrap();
|
||||
let ( subcommand, variant ) =
|
||||
if let Ok(Some(subcommand)) = args.subcommand() { ( Some(subcommand), args.subcommand().unwrap()) }
|
||||
else if let Ok(default) = var("PRIDE_DEFAULT") {
|
||||
if default.is_empty() { ( None, None ) }
|
||||
else if default.contains(';') {
|
||||
let split: Vec<&str> = default.split(';').collect();
|
||||
if let Ok(time) = UNIX_EPOCH.elapsed() {
|
||||
let index = oorandom::Rand32::new(time.as_secs()).rand_u32();
|
||||
let chosen = split[index as usize % split.len()].to_owned();
|
||||
if chosen.contains(' ') {
|
||||
let split: Vec<&str> = chosen.split(' ').collect();
|
||||
( Some(split[0].to_owned()), Some(split[1].to_owned()) )
|
||||
} else { ( Some(chosen), None ) }
|
||||
} else { ( None, None ) }
|
||||
} else if default.contains(' ') {
|
||||
let split: Vec<&str> = default.split(' ').collect();
|
||||
( Some(split[0].to_owned()), Some(split[1].to_owned()) )
|
||||
} else { ( Some(default), None ) }
|
||||
} else { ( None, None ) };
|
||||
|
||||
// get color vec from matched flag
|
||||
let flag: Flag = match subcommand.as_deref() {
|
||||
|
@ -140,7 +161,7 @@ fn main() {
|
|||
Some("lesbian" | "wlw")
|
||||
=> {
|
||||
match variant.as_deref() {
|
||||
Some("7-color")
|
||||
Some("7" | "7-color" | "7-stripe")
|
||||
=> variant::lesbian_7(),
|
||||
_
|
||||
=> flag::lesbian()
|
||||
|
|
Loading…
Reference in a new issue