Skip to content

Commit b4db7dd

Browse files
authored
Add show_tips config option (#108)
1 parent 1509316 commit b4db7dd

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,9 @@ Examples:
389389
# Set verbose mode
390390
stack-pr config common.verbose=True
391391
392+
# Disable usage tips (hide verbose output after commands)
393+
stack-pr config common.show_tips=False
394+
392395
# Set target branch
393396
stack-pr config repo.target=master
394397
@@ -422,6 +425,7 @@ hyperlinks=True
422425
draft=False
423426
keep_body=False
424427
stash=False
428+
show_tips=True
425429
[repo]
426430
remote=origin
427431
target=main

src/stack_pr/cli.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ class CommonArgs:
885885
hyperlinks: bool
886886
verbose: bool
887887
branch_name_template: str
888+
show_tips: bool
888889

889890
@classmethod
890891
def from_args(cls, args: argparse.Namespace) -> CommonArgs:
@@ -896,6 +897,7 @@ def from_args(cls, args: argparse.Namespace) -> CommonArgs:
896897
args.hyperlinks,
897898
args.verbose,
898899
args.branch_name_template,
900+
args.show_tips,
899901
)
900902

901903

@@ -976,12 +978,13 @@ def deduce_base(args: CommonArgs) -> CommonArgs:
976978
args.hyperlinks,
977979
args.verbose,
978980
args.branch_name_template,
981+
args.show_tips,
979982
)
980983

981984

982985
def print_tips_after_export(st: list[StackEntry], args: CommonArgs) -> None:
983986
stack_size = len(st)
984-
if stack_size == 0:
987+
if stack_size == 0 or not args.show_tips:
985988
return
986989

987990
top_commit = args.head
@@ -1377,7 +1380,7 @@ def command_abandon(args: CommonArgs) -> None:
13771380
# ===----------------------------------------------------------------------=== #
13781381
def print_tips_after_view(st: list[StackEntry], args: CommonArgs) -> None:
13791382
stack_size = len(st)
1380-
if stack_size == 0:
1383+
if stack_size == 0 or not args.show_tips:
13811384
return
13821385

13831386
ready_to_land = all(not e.has_missing_info() for e in st)
@@ -1522,6 +1525,12 @@ def create_argparser(
15221525
default=config.get("repo", "branch_name_template", fallback="$USERNAME/stack"),
15231526
help="A template for names of the branches stack-pr would use.",
15241527
)
1528+
common_parser.add_argument(
1529+
"--show-tips",
1530+
action=argparse.BooleanOptionalAction,
1531+
default=config.getboolean("common", "show_tips", fallback=True),
1532+
help="Show or hide usage tips after commands.",
1533+
)
15251534

15261535
parser_submit = subparsers.add_parser(
15271536
"submit",

0 commit comments

Comments
 (0)