feat: debug command only in debug mode
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
d898370d82
commit
f8b31c4c80
1 changed files with 24 additions and 6 deletions
|
@ -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: {}",
|
||||
|
|
Loading…
Reference in a new issue