From 6f0725af3f654b0f451800f688ff2a102031a977 Mon Sep 17 00:00:00 2001 From: Laszlo Kindrat Date: Tue, 2 Dec 2025 18:33:17 -0500 Subject: [PATCH] Hide hints about `land` option when it's disabled stack-info: PR: https://github.com/modular/stack-pr/pull/110, branch: laszlokindrat/stack/1 --- src/stack_pr/cli.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/stack_pr/cli.py b/src/stack_pr/cli.py index f3bf2e0..b5f4023 100755 --- a/src/stack_pr/cli.py +++ b/src/stack_pr/cli.py @@ -903,9 +903,10 @@ class CommonArgs: verbose: bool branch_name_template: str show_tips: bool + land_disabled: bool @classmethod - def from_args(cls, args: argparse.Namespace) -> CommonArgs: + def from_args(cls, args: argparse.Namespace, *, land_disabled: bool) -> CommonArgs: return cls( args.base, args.head, @@ -915,6 +916,7 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs: args.verbose, args.branch_name_template, args.show_tips, + land_disabled, ) @@ -996,6 +998,7 @@ def deduce_base(args: CommonArgs) -> CommonArgs: args.verbose, args.branch_name_template, args.show_tips, + args.land_disabled, ) @@ -1009,7 +1012,8 @@ def print_tips_after_export(st: list[StackEntry], args: CommonArgs) -> None: top_commit = get_current_branch_name() log(b("\nOnce the stack is reviewed, it is ready to land!"), level=1) - log(LAND_STACK_TIP.format(**locals())) + if not args.land_disabled: + log(LAND_STACK_TIP.format(**locals())) # ===----------------------------------------------------------------------=== # @@ -1409,7 +1413,8 @@ def print_tips_after_view(st: list[StackEntry], args: CommonArgs) -> None: if ready_to_land: log(b("\nThis stack is ready to land!")) log(UPDATE_STACK_TIP.format(**locals())) - log(LAND_STACK_TIP.format(**locals())) + if not args.land_disabled: + log(LAND_STACK_TIP.format(**locals())) return # Stack is not ready to land, suggest exporting it first @@ -1651,7 +1656,12 @@ def main() -> None: # noqa: PLR0912 # Make sure "$ID" is present in the branch name template and append it if not args.branch_name_template = fix_branch_name_template(args.branch_name_template) - common_args = CommonArgs.from_args(args) + common_args = CommonArgs.from_args( + args, + land_disabled=( + config.get("land", "style", fallback="bottom-only") == "disable" + ), + ) if common_args.verbose: logger.setLevel(logging.DEBUG)