Skip to content

Commit

Permalink
DNF5 bash completion: Offer package names in all cases
Browse files Browse the repository at this point in the history
For installed packages (for dnf5 commands reinstall, remove, repoquery,
swap) bash completion offered only nevras. Now bash completion for dnf5
offers names in addition to nevras in all cases.
  • Loading branch information
jrohel committed Jan 6, 2025
1 parent 122faec commit 2fcc09b
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dnf5/commands/reinstall/reinstall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void ReinstallCommand::set_argument_parser() {
}
return true;
});
keys->set_complete_hook_func([&ctx](const char * arg) { return match_specs(ctx, arg, true, false, true, true); });
keys->set_complete_hook_func([&ctx](const char * arg) { return match_specs(ctx, arg, true, false, true, false); });
cmd.register_positional_arg(keys);

allow_erasing = std::make_unique<AllowErasingOption>(*this);
Expand Down
2 changes: 1 addition & 1 deletion dnf5/commands/remove/remove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void RemoveCommand::set_argument_parser() {
}
return true;
});
keys->set_complete_hook_func([&ctx](const char * arg) { return match_specs(ctx, arg, true, false, false, true); });
keys->set_complete_hook_func([&ctx](const char * arg) { return match_specs(ctx, arg, true, false, false, false); });
cmd.register_positional_arg(keys);

create_offline_option(*this);
Expand Down
2 changes: 1 addition & 1 deletion dnf5/commands/repoquery/repoquery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void RepoqueryCommand::set_argument_parser() {
});
keys->set_complete_hook_func([this, &ctx](const char * arg) {
if (this->installed_option->get_value()) {
return match_specs(ctx, arg, true, false, false, true);
return match_specs(ctx, arg, true, false, false, false);
} else {
return match_specs(ctx, arg, false, true, true, false);
}
Expand Down
2 changes: 1 addition & 1 deletion dnf5/commands/swap/swap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void SwapCommand::set_argument_parser() {
return true;
});
remove_spec_arg->set_complete_hook_func(
[&ctx](const char * arg) { return match_specs(ctx, arg, true, false, false, true); });
[&ctx](const char * arg) { return match_specs(ctx, arg, true, false, false, false); });
cmd.register_positional_arg(remove_spec_arg);

auto install_spec_arg = parser.add_new_positional_arg("install_spec", 1, nullptr, nullptr);
Expand Down

0 comments on commit 2fcc09b

Please sign in to comment.