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
51
52
53
54
55
|
use colored::Colorize;
use mingling::{
Groupped,
macros::{chain, pack, r_println, renderer},
};
use serde::Serialize;
use crate::{
EntryShowTargetDirectories, EntryShowWorkspaceDirectory, Next, metadata::read_metadata,
res::ResManifestPath,
};
#[derive(Serialize, Groupped)]
pub struct ResultWorkspaceDirectory {
pub path: String,
}
#[derive(Serialize, Groupped)]
pub struct ResultTargetDirectory {
pub path: String,
}
#[chain]
pub fn handle_show_workspace_directory(
_args: EntryShowWorkspaceDirectory,
manifest_path: &ResManifestPath,
) -> Next {
let metadata = read_metadata(manifest_path.resolved()).unwrap();
ResultWorkspaceDirectory {
path: metadata.workspace_root,
}
.to_render()
}
#[chain]
pub fn handle_show_target_directory(
_args: EntryShowTargetDirectories,
manifest_path: &ResManifestPath,
) -> Next {
let metadata = read_metadata(manifest_path.resolved()).unwrap();
ResultTargetDirectory {
path: metadata.target_directory,
}
.to_render()
}
#[renderer]
pub fn render_workspace_directory(prev: ResultWorkspaceDirectory) {
r_println!("{}", prev.path.bright_cyan().bold());
}
#[renderer]
pub fn render_target_directory(prev: ResultTargetDirectory) {
r_println!("{}", prev.path.bright_cyan().bold());
}
|