This commit is contained in:
Vomitblood 2024-03-31 01:15:01 +08:00
parent 0db408e3ff
commit b28d221bcf
8 changed files with 86 additions and 19 deletions

0
.github/workflows/graphs/testing.yml vendored Normal file
View file

11
.github/workflows/testing.yml vendored Normal file
View file

@ -0,0 +1,11 @@
on: [push]
jobs:
build-and-publish:
runs-on: ubuntu-latest
name: My workflow
steps:
- name: Execute Action Graph
uses: actionforge/action@919d415a6b6e22919f7e115cf594ae52ded95041 # v0.8.31
with:
graph_file: testing.yml

View file

@ -1,5 +0,0 @@
{
"rust-analyzer.linkedProjects": [
"./Cargo.toml"
]
}

7
Cargo.lock generated
View file

@ -129,12 +129,6 @@ version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "once_cell"
version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
[[package]]
name = "ppv-lite86"
version = "0.2.17"
@ -228,7 +222,6 @@ name = "rustmon"
version = "0.1.0"
dependencies = [
"clap",
"once_cell",
"rand",
"rust-embed",
"serde_json",

View file

@ -8,5 +8,4 @@ edition = "2021"
clap = "2.0.0"
rand = { version = "0.8.4", features = ["small_rng"] }
serde_json = "1.0"
once_cell = "1.8.0"
rust-embed = "8.3.0"

6
src/bin/testing.py Normal file
View file

@ -0,0 +1,6 @@
x = 0
while x < 100000000:
x += 1
print(x)

View file

@ -1,3 +1,65 @@
// fn main() {
// let mut numbers = [1, 2, 3, 4, 5];
// for i in numbers.iter_mut() {
// *i += 1;
// println!("{}", &*i + 1);
// }
// }
// fn main() {
// let numbers = [1, 9, -2, 0, 23, 20, -7, 13, 37, 20, 56, -18, 20, 3];
// let mut max: i32;
// let mut min: i32;
// let mean: f64;
// max = numbers[0];
// for n in numbers {
// if n > max {
// max = n;
// };
// }
// min = numbers[0];
// for n in numbers {
// if n < min {
// min = n;
// };
// }
// let mut sum = 0;
// for n in numbers {
// sum += n;
// }
// mean = sum as f64 / numbers.len() as f64;
// assert_eq!(max, 56);
// assert_eq!(min, -18);
// assert_eq!(mean, 12.5);
// }
// fn main() {
// let numbers = [1, 9, -2, 0, 23, 20, -7, 13, 37, 20, 56, -18, 20, 3];
// let max = *numbers.iter().max().unwrap();
// let min = *numbers.iter().min().unwrap();
// let sum: i32 = numbers.iter().sum();
// let mean = sum as f64 / numbers.len() as f64;
// assert_eq!(max, 56);
// assert_eq!(min, -18);
// assert_eq!(mean, 12.5);
// }
use std::io::Write;
fn main() {
println!("Hello, world!")
let mut string_input = String::new();
print!("Enter a string: ");
std::io::stdout().flush().unwrap();
std::io::stdin().read_line(&mut string_input).unwrap();
let mut trimmed_string = string_input.trim().to_string().push_str("hello");
println!("You entered: {}", trimmed_string);
}

View file

@ -27,7 +27,7 @@ const GENERATIONS: [(&str, (u32, u32)); 8] = [
];
fn print_file(filepath: &str) -> std::io::Result<()> {
ColorScriptsDir::get(filepath)
return ColorScriptsDir::get(filepath)
.map(|file| {
let content = std::str::from_utf8(file.data.as_ref()).unwrap();
println!("{}", content);
@ -35,7 +35,7 @@ fn print_file(filepath: &str) -> std::io::Result<()> {
.ok_or(std::io::Error::new(
std::io::ErrorKind::NotFound,
"File not found",
))
));
}
fn list_pokemon_names() -> std::io::Result<()> {
@ -59,7 +59,7 @@ fn list_pokemon_names() -> std::io::Result<()> {
println!("Use the --name flag to view a specific Pokémon");
println!("Tip: Use `grep` to search for a specific Pokémon");
Ok(())
return Ok(());
}
fn show_pokemon_by_name(
@ -132,7 +132,7 @@ fn show_pokemon_by_name(
// Use the adjusted function to print file contents from embedded resources
print_file(&file_path)?;
Ok(())
return Ok(());
}
fn show_random_pokemon(
@ -180,7 +180,7 @@ fn show_random_pokemon(
std::process::exit(1);
}
Ok(())
return Ok(());
}
#[cfg(target_os = "windows")]
@ -246,6 +246,7 @@ fn main() {
.value_name("GENERATION")
.help("Show a random pokemon. This flag can optionally be followed by a generation number or range (1-8) to show random pokemon from a specific generation or range of generations. The generations can be provided as a continuous range (eg. 1-3) or as a list of generations (1,3,6)"),
)
.after_help("P.S. Use the minimon command for a minimalistic version of this tool")
.get_matches();
if matches.is_present("list") {