diff --git a/pkgr/src/commands.rs b/pkgr/src/commands.rs index 01a1619..9440645 100644 --- a/pkgr/src/commands.rs +++ b/pkgr/src/commands.rs @@ -39,7 +39,12 @@ pub enum Command { }, /// Update packages on the system Update, - #[command(hide = true)] + /// Get info about pkgr + Info { + #[arg(short, long, default_value_t = false)] + detailed: bool + }, + #[cfg(debug_assertions)] Debug, #[command(hide = true)] None, @@ -60,7 +65,7 @@ impl Command { .unwrap(); info!("Parsing package..."); - trace!("Fetching package: {}", package_identifier); + trace!("Fetching package: {:?}", package_identifier); let mut pkg = Package::try_fetch(package_identifier.clone()).unwrap(); debug!("manifest size: {}kb", pkg.pkgfile.manifest.len() / 1024); debug!("files size: {}kb", pkg.pkgfile.data.len() / 1024); @@ -107,6 +112,23 @@ impl Command { Command::Update => { error!("Update is not yet implemented."); } + Command::Info { + detailed + } => { + info!("Welcome to pkgr!\n\ + {}\n\ + To get help please run \"{} -h\"", env!("CARGO_PKG_DESCRIPTION"), std::env::args().nth(0).unwrap()); + if *detailed { + info!(""); + info!("version: {}", env!("CARGO_PKG_VERSION")); + info!("authors: {}", env!("CARGO_PKG_AUTHORS")); + + info!(""); + info!("If you can't seem to figure something out, use debug!"); + trace!("Trace should really only be used by PKGR devs."); + } + } + #[cfg(debug_assertions)] Command::Debug => { trace!("Trace message.\nWith newline."); debug!("Debug message.\nWith newline."); @@ -124,10 +146,6 @@ impl Command { .unwrap(); } - info!(""); - info!("PKGR VERSION: {}", env!("CARGO_PKG_VERSION")); - info!("PKGR AUTHORS: {}", env!("CARGO_PKG_AUTHORS")); - info!("PKGR DESCRIPTION: {}", env!("CARGO_PKG_DESCRIPTION")); info!(""); info!( "PKGR_LOG_LEVEL: {}",