-
-
Notifications
You must be signed in to change notification settings - Fork 244
Expand file tree
/
Copy pathmod.rs
More file actions
45 lines (39 loc) · 1.29 KB
/
mod.rs
File metadata and controls
45 lines (39 loc) · 1.29 KB
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 anyhow::Result;
use clap::{ArgMatches, Command};
use crate::utils::args::ArgExt as _;
pub mod upload;
macro_rules! each_subcommand {
($mac:ident) => {
$mac!(upload);
};
}
pub fn make_command(mut command: Command) -> Command {
macro_rules! add_subcommand {
($name:ident) => {{
command = command.subcommand(crate::commands::code_mappings::$name::make_command(
Command::new(stringify!($name).replace('_', "-")),
));
}};
}
command = command
.about("Manage code mappings for Sentry. Code mappings link stack trace paths to source code paths in your repository, enabling source context and code linking in Sentry.")
.subcommand_required(true)
.arg_required_else_help(true)
.org_arg()
.project_arg(false);
each_subcommand!(add_subcommand);
command
}
pub fn execute(matches: &ArgMatches) -> Result<()> {
macro_rules! execute_subcommand {
($name:ident) => {{
if let Some(sub_matches) =
matches.subcommand_matches(&stringify!($name).replace('_', "-"))
{
return crate::commands::code_mappings::$name::execute(&sub_matches);
}
}};
}
each_subcommand!(execute_subcommand);
unreachable!();
}