From 427a3cb1820ccf2c255df8a0c8883e457c92adaf Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 28 Mar 2024 22:34:16 +0100 Subject: [PATCH] add --version option --- src/main.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main.rs b/src/main.rs index f787f90..0a3b8b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,8 +12,21 @@ use bevy::window::{Window, WindowMode, PrimaryWindow, CursorGrabMode}; use bevy::diagnostic::FrameTimeDiagnosticsPlugin; use bevy::prelude::*; use bevy_embedded_assets::{EmbeddedAssetPlugin, PluginMode}; +use std::env; fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 { + if args[1] == "--version" || args[1] == "-v" { + let version = option_env!("CARGO_PKG_VERSION").unwrap(); + let name = option_env!("CARGO_PKG_NAME").unwrap(); + let homepage = option_env!("CARGO_PKG_HOMEPAGE").unwrap(); + println!("{name} {version}"); + println!("License: GNU GPL version 3: https://gnu.org/licenses/gpl.html"); + println!("{homepage}"); + return; + } + } if cfg!(debug_assertions) { App::new().add_plugins(( OutFlyPlugin,