Skip to content

Commit 7e430ff

Browse files
committed
Move deprecated command information from Args to main
1 parent a1dc47f commit 7e430ff

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

mithril-client-cli/src/main.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,10 @@ impl Args {
152152

153153
fn handle_deprecated_decorator(
154154
args_result: Result<Self, ClapError>,
155+
deprecated_commands: Vec<DeprecatedCommand>,
155156
) -> Result<Self, ClapError> {
156157
let styles = Args::command().get_styles().clone();
157-
Deprecation::handle_deprecated_commands(
158-
args_result,
159-
styles,
160-
vec![DeprecatedCommand::new("snapshot", "cardano-db")],
161-
)
158+
Deprecation::handle_deprecated_commands(args_result, styles, deprecated_commands)
162159
}
163160
}
164161

@@ -229,7 +226,10 @@ impl ArtifactCommands {
229226
async fn main() -> MithrilResult<()> {
230227
// Load args
231228
let args = Args::parse_with_decorator(&|result: Result<Args, ClapError>| {
232-
Args::handle_deprecated_decorator(result)
229+
Args::handle_deprecated_decorator(
230+
result,
231+
vec![DeprecatedCommand::new("snapshot", "cardano-db")],
232+
)
233233
});
234234
let _guard = slog_scope::set_global_logger(args.build_logger()?);
235235

@@ -253,15 +253,4 @@ mod tests {
253253
.await
254254
.expect_err("Should fail if unstable flag missing");
255255
}
256-
257-
#[test]
258-
fn snapshot_is_not_a_command_anymore() {
259-
let args_result = Args::try_parse_from(["", "snapshot", "list"]);
260-
let result = Args::handle_deprecated_decorator(args_result);
261-
262-
assert!(result.is_err());
263-
let message = result.err().unwrap().to_string();
264-
assert!(message.contains("'snapshot'"));
265-
assert!(message.contains("'cardano-db'"));
266-
}
267256
}

0 commit comments

Comments
 (0)