Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.unwrap_or_default() instead of falling back to "<prefix>" in single-command help #255

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/builtins/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,7 @@ async fn help_single_command<U, E>(
subprefix = Some(format!(" /{}", command.name));
}
if command.prefix_action.is_some() {
let prefix = match get_prefix_from_options(ctx).await {
Some(prefix) => prefix,
// None can happen if the prefix is dynamic, and the callback
// fails due to help being invoked with slash or context menu
// commands. Not sure there's a better way to handle this.
None => String::from("<prefix>"),
};
let prefix = get_prefix_from_options(ctx).await.unwrap_or_default();
invocations.push(format!("`{}{}`", prefix, command.name));
if subprefix.is_none() {
subprefix = Some(format!(" {}{}", prefix, command.name));
Expand Down