Skip to content

Commit

Permalink
fix: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
mastrolube committed Feb 10, 2024
1 parent ff6c85a commit b9f67c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions GramAddict/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,23 +152,23 @@ def _is_legacy_arg(arg):
logger.debug("Arguments used:")
if self.config:
logger.debug(f"Config used: {self.config}")
if not len(self.args) > 0:
if len(self.args) == 0:
self.parser.print_help()
exit(0)
else:
if self.first_run:
logger.debug(f"Arguments used: {' '.join(sys.argv[1:])}")
if self.config:
logger.debug(f"Config used: {self.config}")
if not len(sys.argv) > 1:
if len(sys.argv) <= 1:
self.parser.print_help()
exit(0)
if self.module:
arg_str = ""
for k, v in self.args.items():
new_key = k.replace("_", "-")
new_key = " --" + new_key
arg_str += new_key + " " + v
new_key = f" --{new_key}"
arg_str += f"{new_key} {v}"
self.args, self.unknown_args = self.parser.parse_known_args(args=arg_str)
else:
self.args, self.unknown_args = self.parser.parse_known_args()
Expand Down

0 comments on commit b9f67c9

Please sign in to comment.