Skip to content

Commit

Permalink
fix --config / cfg arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
HotNoob committed Sep 22, 2024
1 parent 1a1b720 commit bde13ba
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion protocol_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,15 @@ def main():
parser = argparse.ArgumentParser(description='Python Protocol Gateway')

# Add arguments
parser.add_argument('--config', '-c', type=str, help='Specify Config File', default='config.cfg')
parser.add_argument('--config', '-c', type=str, help='Specify Config File')

# Add a positional argument with default
parser.add_argument('positional_config', type=str, help='Specify Config File', nargs='?', default='config.cfg')

# Parse arguments
args = parser.parse_args()

# If '--config' is provided, use it; otherwise, fall back to the positional or default.
config_file = args.config if args.config else args.positional_config

main()

0 comments on commit bde13ba

Please sign in to comment.