Skip to content

Commit

Permalink
Settings: Python 3.8 does not have ArgumentParser(exit_on_error=False)
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Nov 15, 2023
1 parent a900403 commit 89f8c3a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions cratedb_toolkit/util/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,13 @@ def obtain_setting_cli(
"""
Obtain a command line argument value from `sys.argv`.
"""
parser = argparse.ArgumentParser(exit_on_error=False)
parser = argparse.ArgumentParser()
arg = parser.add_argument(name, default=default, help=help)
namespace, args = parser.parse_known_args()
return parser, getattr(namespace, arg.dest)
try:
namespace, args = parser.parse_known_args()
return parser, getattr(namespace, arg.dest)
except argparse.ArgumentError:
return parser, None

Check warning on line 113 in cratedb_toolkit/util/setting.py

View check run for this annotation

Codecov / codecov/patch

cratedb_toolkit/util/setting.py#L112-L113

Added lines #L112 - L113 were not covered by tests


def argv_has_long_option() -> bool:
Expand Down

0 comments on commit 89f8c3a

Please sign in to comment.