From 782429c408ed8ff228c0a87544cfe38fc11ce516 Mon Sep 17 00:00:00 2001 From: dev2ero Date: Thu, 31 Mar 2022 19:05:29 +0800 Subject: [PATCH] bugfix: For argparse, add nargs='?' parameter for default values --- pwndbg/commands/context.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pwndbg/commands/context.py b/pwndbg/commands/context.py index ec3902019..496f11577 100644 --- a/pwndbg/commands/context.py +++ b/pwndbg/commands/context.py @@ -133,8 +133,8 @@ parser.description = "Sets the output of a context section." parser.add_argument("section", type=str, help="The section which is to be configured. ('regs', 'disasm', 'code', 'stack', 'backtrace', and/or 'args')") parser.add_argument("path", type=str, help="The path to which the output is written") parser.add_argument("clearing", type=bool, help="Indicates weather to clear the output") -parser.add_argument("banner", type=str, default="both", help="Where a banner should be placed: both, top , bottom, none") -parser.add_argument("width", type=int, default=None, help="Sets a fixed width (used for banner). Set to None for auto") +parser.add_argument("banner", type=str, nargs='?', default="both", help="Where a banner should be placed: both, top , bottom, none") +parser.add_argument("width", type=int, nargs='?', default=None, help="Sets a fixed width (used for banner). Set to None for auto") @pwndbg.commands.ArgparsedCommand(parser, aliases=['ctx-out']) def contextoutput(section, path, clearing, banner="both", width=None): outputs[section] = path