diff --git a/docs/changelog.md b/docs/changelog.md index d7b3af0..715a70f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased +***Added:*** + +- Allow for forwarding of unknown management commands e.g. if apps have their own `self` commands + ## 0.12.0 - 2023-10-07 ***Added:*** diff --git a/src/main.rs b/src/main.rs index 9d85b5b..4165f86 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,13 +17,19 @@ use crate::commands::cli::Cli; fn main() -> Result<()> { app::initialize()?; - match env::args().nth(1).as_deref() { - Some(env!("PYAPP_SELF_COMMAND")) => Cli::parse().exec(), - _ => { - distribution::ensure_ready()?; - distribution::run_project()?; + if let Some(env!("PYAPP_SELF_COMMAND")) = env::args().nth(1).as_deref() { + match Cli::try_parse() { + Ok(cli) => return cli.exec(), + Err(err) => { + if !err.use_stderr() { + err.exit(); + } + } + }; + }; - Ok(()) - } - } + distribution::ensure_ready()?; + distribution::run_project()?; + + Ok(()) }