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

Suppress header in dnf list --upgrades in --quiet mode #753

Closed
abitrolly opened this issue Jul 20, 2023 · 8 comments
Closed

Suppress header in dnf list --upgrades in --quiet mode #753

abitrolly opened this issue Jul 20, 2023 · 8 comments
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take

Comments

@abitrolly
Copy link

The line "Available upgrades" is not suppressed when running dnf list --upgrades --quiet.

package_matched |= sections->add_section("Available upgrades", base_query, colorizer);

Is there any way to turn it off?

@pkratoch
Copy link
Contributor

pkratoch commented Jan 8, 2025

Sorry for no comment for so long. This issue is valid. The --quiet option doesn't work yet, see #570 .

@pkratoch pkratoch added Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take labels Jan 8, 2025
@abitrolly
Copy link
Author

That's was an unfortunate choice to use CPP instead of more safe and modern Rust or more maintainable Go in 2021. I guess the choice was made to improve the speed, but we all know that it is algorithmic strength and parallelization that gives the best results.

Maybe the CPP choice was to get the minimal footprint, because dnf5 is obligatory for minimal installs.

As a co maintainer of https://cli.urfave.org/ I could give you a patch in Go, but for CPP I have no idea how to add global flag and check for it here. Lemme ask LLM.

@abitrolly
Copy link
Author

Asked LLM, but it was unable to discover where quiet is defined, so here is is.

dnf5/dnf5/main.cpp

Lines 150 to 163 in 2d95658

auto quiet = parser.add_new_named_arg("quiet");
quiet->set_long_name("quiet");
quiet->set_short_name('q');
quiet->set_description(
_("In combination with a non-interactive command, shows just the relevant content. "
"Suppresses messages notifying about the current state or actions of dnf5."));
quiet->set_parse_hook_func([&ctx](
[[maybe_unused]] ArgumentParser::NamedArg * arg,
[[maybe_unused]] const char * option,
[[maybe_unused]] const char * value) {
ctx.set_quiet(true);
return true;
});
global_options_group->register_argument(quiet);

And here is the commit that added it, with the print_info function that takes care of the check.

0caf87c

Need to check if it is still callable.

@abitrolly
Copy link
Author

abitrolly commented Jan 12, 2025

print_info is callable, but the messed up thing is that the output is made by library! libdnf5::cli::output::PackageListSections

sections->print(colorizer);

auto sections = create_output();

std::unique_ptr<libdnf5::cli::output::PackageListSections> ListCommand::create_output() {
auto out = std::make_unique<libdnf5::cli::output::PackageListSections>();
return out;
}

That's a poor design to me. How to handle user input and output is the responsibility of user facing client code. The library should just handle the data - JSON or whatever in and out.

@abitrolly
Copy link
Author

void PackageListSections::print(const std::unique_ptr<PkgColorizer> & colorizer) {

@kontura
Copy link
Contributor

kontura commented Jan 24, 2025

We have decided to reject this functionality.
See #2001 for more details.

@kontura kontura closed this as completed Jan 24, 2025
@github-project-automation github-project-automation bot moved this from Backlog to Done in DNF team Jan 24, 2025
@kontura kontura closed this as not planned Won't fix, can't repro, duplicate, stale Jan 24, 2025
@abitrolly
Copy link
Author

First @pkratoch says that the issue is valid, I spend time, now it is not valid. :(

@pkratoch
Copy link
Contributor

@abitrolly I am sorry, I previously only confirmed that the --quiet option is not implemented yet and thought this is just an instance of where it should be applied, but didn't look into the details. I agree with it being closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: MEDIUM Triaged Someone on the DNF 5 team has read the issue and determined the next steps to take
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants