commit 4f7d6a5e24912fba7c0a8124b778cffc5c30e445 Author: Unbewohnte Date: Sat Aug 14 09:25:10 2021 +0300 (ᗜ˰ᗜ)/ The first working version \(ᗜˬᗜ) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..bb098bf --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "fumosay" +version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..459885a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "fumosay" +version = "0.1.0" +edition = "2018" +authors = ["Unbewohnte | Nikolay Kasyanov "] +description = "Like cowsay, but with soft friends" +readme = "README.md" +license = "MIT" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a08fc5c --- /dev/null +++ b/LICENSE @@ -0,0 +1,9 @@ +The MIT License (MIT) + +Copyright © 2021 Unbewohne | Nikolay Kasyanov + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..334382a --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# fumosay +## Like cowsay, but with soft friends (ᗜˬᗜ) diff --git a/fumofiles/fumo.fumo b/fumofiles/fumo.fumo new file mode 100644 index 0000000..643b57f --- /dev/null +++ b/fumofiles/fumo.fumo @@ -0,0 +1,6 @@ + __________ +( !message ) + ---------- + () + () + \(ᗜˬᗜ)/ \ No newline at end of file diff --git a/src/fumo.rs b/src/fumo.rs new file mode 100644 index 0000000..ddfc1e3 --- /dev/null +++ b/src/fumo.rs @@ -0,0 +1,8 @@ +pub const MESSAGE_INDICATOR: &str = "!message"; + +pub fn sayify(fumofile: &mut String, message: &str) -> String { + if fumofile.contains(MESSAGE_INDICATOR) { + return fumofile.replace(MESSAGE_INDICATOR,message); + } + return format!("{}\n{}", fumofile, message); +} \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..4bb9296 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,8 @@ +mod fumo; +fn main() { + let mut fumofile_contents = std::fs::read_to_string(std::path::Path::new("./fumofiles/fumo.fumo")).unwrap(); + let message: String = fumo::sayify(&mut fumofile_contents,"fumo"); + println!("{}", message); +} + +