diff --git a/man/hyprwall.1 b/man/hyprwall.1 index fe3a68b..43568cd 100644 --- a/man/hyprwall.1 +++ b/man/hyprwall.1 @@ -48,6 +48,10 @@ Force overwrite of existing config file. .br Should be used with \fB-g\fR. +.TP +\fB\-C\fR, \fB\-\-copyright\fR +Display copyright information + .TP \fB\-h\fR, \fB\-\-help\fR Print help diff --git a/src/main.rs b/src/main.rs index 633a625..9bc13ce 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ use shellexpand::tilde; use std::fs::{self, OpenOptions}; use std::io::{Read, Write}; use std::path::{Path, PathBuf}; +use std::time::{SystemTime, UNIX_EPOCH}; use tokio::process::Command as TokioCommand; use tokio::runtime::Runtime; @@ -54,6 +55,9 @@ struct Cli { help = "Force overwrite of existing config file (should be used with -g)" )] force: bool, + + #[arg(short = 'C', long, help = "Display copyright information")] + copyright: bool, } fn main() { @@ -72,6 +76,32 @@ fn main() { return; } + if cli.copyright { + let current_year = 1970 + + (SystemTime::now() + .duration_since(UNIX_EPOCH) + .expect("Time went backwards") + .as_secs() + / (365 * 24 * 60 * 60)); + println!("Copyright (C) {} Nyx, Adam Perkowski", current_year); + println!( + "\nThis program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, version 2 of +the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, see +." + ); + return; + } + if !config_exists() { generate_config(); }