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

Make help command remind users about help-advanced command #14402

Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions src/python/pants/help/help_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ def add_option(ohis, *, category=None):
add_option(oshi.advanced, category="advanced")
if self._show_deprecated:
add_option(oshi.deprecated, category="deprecated")
if oshi.advanced and not self._show_advanced:
lines.append(
self.maybe_green(
f"Advanced options available. You can list them by running "
f"./pants help-advanced {oshi.scope}."
)
)
kaos marked this conversation as resolved.
Show resolved Hide resolved
return [*lines, ""]

def format_option(self, ohi: OptionHelpInfo) -> List[str]:
Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/help/help_formatter_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_suppress_advanced(self):
args = ["--foo"]
kwargs = {"advanced": True}
lines = self._format_for_global_scope(False, False, args, kwargs)
assert len(lines) == 8
assert len(lines) == 9
assert not any("--foo" in line for line in lines)
lines = self._format_for_global_scope(True, False, args, kwargs)
assert len(lines) == 18
Expand Down