Skip to content

Commit ddd34d6

Browse files
committed
rework the match to check option first
1 parent e7cc148 commit ddd34d6

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

mdbook-goals/src/main.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -72,42 +72,42 @@ enum Command {
7272
fn main() -> anyhow::Result<()> {
7373
let opt = Opt::from_args();
7474

75-
match &opt.cmd {
76-
Some(Command::Supports { renderer }) => {
75+
let Some(cmd) = &opt.cmd else {
76+
return handle_preprocessing(&GoalPreprocessor);
77+
};
78+
79+
match cmd {
80+
Command::Supports { renderer } => {
7781
handle_supports(&GoalPreprocessor, renderer)?;
7882
}
7983

80-
Some(Command::FCP { path }) => {
84+
Command::FCP { path } => {
8185
rfc::generate_comment(&path)?;
8286
}
8387

84-
Some(Command::Check {}) => {
88+
Command::Check {} => {
8589
check()?;
8690
}
8791

88-
Some(Command::RFC { path }) => {
92+
Command::RFC { path } => {
8993
rfc::generate_rfc(&path)?;
9094
}
9195

92-
Some(Command::Issues {
96+
Command::Issues {
9397
path,
9498
commit,
9599
sleep,
96-
}) => {
100+
} => {
97101
rfc::generate_issues(&opt.repository, path, *commit, *sleep)
98102
.with_context(|| format!("failed to adjust issues; rerun command to resume"))?;
99103
}
100104

101-
Some(Command::TeamRepo {
105+
Command::TeamRepo {
102106
path,
103107
team_repo_path,
104-
}) => {
108+
} => {
105109
team_repo::generate_team_repo(&path, team_repo_path)?;
106110
}
107-
108-
None => {
109-
handle_preprocessing(&GoalPreprocessor)?;
110-
}
111111
}
112112

113113
Ok(())

0 commit comments

Comments
 (0)