Skip to content

Determine how to handle --quiet in commands with subcommands #12957

Closed
@ehuss

Description

@ehuss

Commands that have subcommands (like cargo report future-incompat, cargo config get, cargo owner add, cargo clean gc, etc.) currently don't support the --quiet flag. The problem is:

arg_quiet() is specified on every command individually, instead of using .global(true) like --verbose does. This is done in order to customize the help string on some commands (like cargo test).

AFAIK, we can't have both .global(true) and a per-command customized help text.

This means that commands like cargo owner add don't support the --quiet flag. It doesn't work to add .arg_quiet() on the subcommand because config_configure only looks at the arguments of the top-level command, and the global arguments. It isn't capable of seeing subcommands.

I don't really know how to fix this. Some ideas:

  • Change config_configure to somehow "see" subcommand arguments.
  • Have each subcommand manually set the quiet argument on the config. This might have some awkwardness, since config_configure handles things like clashing arguments (I suspect clap's conflicts_with won't help with that).
  • Drop support for per-command customized help text, and use .global(true).

Metadata

Metadata

Assignees

Labels

A-cargo-apiArea: cargo-the-library API and internal code issuesA-cliArea: Command-line interface, option parsing, etc.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions