Skip to content
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -422,6 +425,7 @@ hyperlinks=True
draft=False
keep_body=False
stash=False
show_tips=True
[repo]
remote=origin
target=main
Expand Down
13 changes: 11 additions & 2 deletions src/stack_pr/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -896,6 +897,7 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs:
args.hyperlinks,
args.verbose,
args.branch_name_template,
args.show_tips,
)


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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",
Expand Down
Loading