diff --git a/README.md b/README.md index 0c80789..ace3c48 100644 --- a/README.md +++ b/README.md @@ -389,6 +389,9 @@ Examples: # Set verbose mode stack-pr config common.verbose=True +# Disable usage tips (hide verbose output after commands) +stack-pr config common.show_tips=False + # Set target branch stack-pr config repo.target=master @@ -422,6 +425,7 @@ hyperlinks=True draft=False keep_body=False stash=False +show_tips=True [repo] remote=origin target=main diff --git a/src/stack_pr/cli.py b/src/stack_pr/cli.py index afda0dd..5b14e50 100755 --- a/src/stack_pr/cli.py +++ b/src/stack_pr/cli.py @@ -885,6 +885,7 @@ class CommonArgs: hyperlinks: bool verbose: bool branch_name_template: str + show_tips: bool @classmethod def from_args(cls, args: argparse.Namespace) -> CommonArgs: @@ -896,6 +897,7 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs: args.hyperlinks, args.verbose, args.branch_name_template, + args.show_tips, ) @@ -976,12 +978,13 @@ def deduce_base(args: CommonArgs) -> CommonArgs: args.hyperlinks, args.verbose, args.branch_name_template, + args.show_tips, ) def print_tips_after_export(st: list[StackEntry], args: CommonArgs) -> None: stack_size = len(st) - if stack_size == 0: + if stack_size == 0 or not args.show_tips: return top_commit = args.head @@ -1377,7 +1380,7 @@ def command_abandon(args: CommonArgs) -> None: # ===----------------------------------------------------------------------=== # def print_tips_after_view(st: list[StackEntry], args: CommonArgs) -> None: stack_size = len(st) - if stack_size == 0: + if stack_size == 0 or not args.show_tips: return ready_to_land = all(not e.has_missing_info() for e in st) @@ -1522,6 +1525,12 @@ def create_argparser( default=config.get("repo", "branch_name_template", fallback="$USERNAME/stack"), help="A template for names of the branches stack-pr would use.", ) + common_parser.add_argument( + "--show-tips", + action=argparse.BooleanOptionalAction, + default=config.getboolean("common", "show_tips", fallback=True), + help="Show or hide usage tips after commands.", + ) parser_submit = subparsers.add_parser( "submit",