Skip to content

Commit bde13ba

Browse files
committed
fix --config / cfg arguments
1 parent 1a1b720 commit bde13ba

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

protocol_gateway.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,15 @@ def main():
233233
parser = argparse.ArgumentParser(description='Python Protocol Gateway')
234234

235235
# Add arguments
236-
parser.add_argument('--config', '-c', type=str, help='Specify Config File', default='config.cfg')
236+
parser.add_argument('--config', '-c', type=str, help='Specify Config File')
237+
238+
# Add a positional argument with default
239+
parser.add_argument('positional_config', type=str, help='Specify Config File', nargs='?', default='config.cfg')
240+
237241
# Parse arguments
238242
args = parser.parse_args()
239243

244+
# If '--config' is provided, use it; otherwise, fall back to the positional or default.
245+
config_file = args.config if args.config else args.positional_config
246+
240247
main()

0 commit comments

Comments
 (0)