Skip to content

Commit

Permalink
Allow for forwarding of unknown management commands
Browse files Browse the repository at this point in the history
  • Loading branch information
ofek committed Dec 31, 2023
1 parent 89fdf18 commit 67c7eb3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 5 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## Unreleased

## 0.12.0 - 2023-10-07
***Added:***

- Allow for forwarding of unknown management commands e.g. if apps have their own `self` commands

## 0.12.0 - 2023-12-30

***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 67c7eb3

Please sign in to comment.