1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::imports::*;

#[derive(Default, Handler)]
#[help("Exit the application")]
pub struct Exit;

impl Exit {
    async fn main(self: Arc<Self>, ctx: &Arc<dyn Context>, _argv: Vec<String>, _cmd: &str) -> cli::Result<()> {
        let term = ctx.term();

        term.writeln("bye!");
        #[cfg(not(target_arch = "wasm32"))]
        term.exit().await;
        #[cfg(target_arch = "wasm32")]
        workflow_dom::utils::window().location().reload().ok();

        Ok(())
    }
}