Skip to content

Commit

Permalink
Allow for forwarding of unknown management commands (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek authored Dec 31, 2023
1 parent 89fdf18 commit 5f14613
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:***
Expand Down
22 changes: 14 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

0 comments on commit 5f14613

Please sign in to comment.