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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Everything related to the app's CLI.
use crateCfg;
use crateCli;
use crateCommand;
use cratedefault;
use crateexclude;
use craterevert;
/// A subcommand engine, a structure that encapsulates the logic of a subcommand.
/// Returns the engine corresponding to the given `cli` and `cfg`.
///
/// # Parameters
///
/// - `cli`: The CLI arguments.
/// - `cfg`: The configuration values.
///
/// # Returns
///
/// The parametrized engine for running the app's logic, or an error
/// if engine creation failed.
///
/// # Examples
///
/// ```rust,no_run
/// use clap::Parser;
/// use fmtna::cfg::Cfg;
/// use fmtna::cli::Cli;
/// use fmtna::engine;
///
/// # fn main() -> Result<(), Box<dyn std::error::Error>> {
/// let cli = Cli::parse();
/// let cfg: Cfg = confy::load("my_crate", "config")?;
/// let mut engine = engine::get_engine(cli, cfg)?;
/// engine.run()?;
/// # Ok(())
/// # }
/// ```