1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//! Has the [`run_cli`] function

/// Calls the [`ui::run_common::<C>`] function supplying it with the commandline
///  interface template as a type. Any errors are thrown back to the calling
/// function. A debug message is then displayed conveying that the program is
/// being run in the CLI mode.
pub fn run_cli() -> Result<(), paxy::Error> {
    // Initialize the app to setup basic functions like config and logging
    let (console_input, _logging_worker_guards) =
        app::run_common::<CliTemplate>().context(AppSnafu {})?;

    // Notify that the app is running in CLI mode
    tracing::debug!(
        "Running in {} mode... {}",
        "CLI".blue(),
        console::Emoji("🔤", "")
    );

    // Delegate handling actions
    action::handle_action(console_input).context(ActionSnafu {})?;

    Ok(())
}
// region: IMPORTS

use owo_colors::OwoColorize;
use paxy::{
    action,
    app::{self, ui::console_template::cli::CliTemplate},
    ActionSnafu,
    AppSnafu,
};
use snafu::ResultExt;

// endregion: IMPORTS