Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
conditional compiling by attributes instead of if-statements\
Browse files Browse the repository at this point in the history
added donation notice to README.md
  • Loading branch information
ThatFrogDev committed Mar 15, 2024
1 parent 7943430 commit b3bcf1f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::{
return_to_main::return_to_main,
utilities::{
cursor_to_origin::cursor_to_origin,
format_md::{inline, paragraph},
format_md::paragraph,
truncate_note::truncate_note,
},
};
Expand Down Expand Up @@ -57,16 +57,16 @@ fn display_about() -> Result<(), Box<dyn std::error::Error>> {
println!("{}", paragraph(&skin, &format!("# About Notabena")));
println!(
"{}",
inline(
paragraph(
&skin,
"**Notabena** is a FOSS note-taking CLI tool, written in Rust.\n"
"**Notabena** is a FOSS note-taking CLI tool, written in Rust.\nDonations are always a great way to help us keeping the project alive. It can be done here: https://paypal.me/Notabena (ctrl+click to follow link)."
)
);
println!(
"version: v{}, licensed under: GPL v3",
env!("CARGO_PKG_VERSION")
);
println!("COPYRIGHT (c) 2023-PRESENT NOTABENA ORGANISATION\nPROJECT LEADS @ThatFrogDev, @MrSerge01, GITHUB CONTRIBUTORS\n");
println!("COPYRIGHT (c) 2023-PRESENT NOTABENA ORGANISATION\nPROJECT LEADS @ThatFrogDev, @MrSerge01, GITHUB CONTRIBUTORS\n\n(scroll up if you can't read everything)");

Ok(())
}
16 changes: 9 additions & 7 deletions src/utilities/cursor_to_origin.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use std::process::Command;

#[cfg(target_os = "windows")]
pub fn cursor_to_origin() -> Result<(), Box<dyn std::error::Error>> {
if cfg!(target_os = "windows") {
Command::new("cmd").args(["/c", "cls"]).spawn()?.wait()?;
Ok(())
} else {
Command::new("clear").spawn()?.wait()?;
Ok(())
}
Command::new("cmd").args(["/c", "cls"]).spawn()?.wait()?;
Ok(())
}

#[cfg(not(target_os = "windows"))]
pub fn cursor_to_origin() -> Result<(), Box<dyn std::error::Error>> {
Command::new("clear").spawn()?.wait()?;
Ok(())
}

0 comments on commit b3bcf1f

Please sign in to comment.