aboutsummaryrefslogtreecommitdiff
path: root/mling/src/cli.rs
blob: ed5dd0613c7a4bf12517e3650f951d07359875ca (plain) (blame)
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
use mingling::{
    macros::renderer,
    setup::{BasicProgramSetup, GeneralRendererSetup},
};

use crate::{__completion_gen::CompletionDispatcher, DispatcherNotFound, ThisProgram};

pub mod list;
pub use list::*;

pub mod namespace_mgr;
pub use namespace_mgr::*;

pub mod read;
pub use read::*;

pub mod install;
pub use install::*;

pub fn cli_entry() {
    let mut program = ThisProgram::new();

    program.with_setup(BasicProgramSetup);
    program.with_setup(GeneralRendererSetup);
    program.with_dispatcher(CompletionDispatcher);

    program.with_dispatcher(ListInstalledCommand);
    program.with_dispatchers((
        TrustNamespaceCommand,
        UntrustNamespaceCommand,
        SetTrustNamespaceCommand,
        RemoveNamespaceCommand,
    ));
    program.with_dispatcher(InstallCommand);
    program.with_dispatchers((
        ReadTargetDirCommand,
        ReadWorkspaceRootCommand,
        ReadBinariesCommand,
    ));

    program.exec();
}

#[renderer]
pub(crate) fn render_help(_prev: DispatcherNotFound) {}