From 4f7d6a5e24912fba7c0a8124b778cffc5c30e445 Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Sat, 14 Aug 2021 09:25:10 +0300 Subject: [PATCH] =?UTF-8?q?(=E1=97=9C=CB=B0=E1=97=9C)/=20The=20first=20wor?= =?UTF-8?q?king=20version=20\(=E1=97=9C=CB=AC=E1=97=9C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + Cargo.lock | 7 +++++++ Cargo.toml | 12 ++++++++++++ LICENSE | 9 +++++++++ README.md | 2 ++ fumofiles/fumo.fumo | 6 ++++++ src/fumo.rs | 8 ++++++++ src/main.rs | 8 ++++++++ 8 files changed, 53 insertions(+) create mode 100644 .gitignore create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 LICENSE create mode 100644 README.md create mode 100644 fumofiles/fumo.fumo create mode 100644 src/fumo.rs create mode 100644 src/main.rs 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); +} + +