Invert negative arguments in --help parsing

"Negative logic" is harder to follow. We may define only a
negative option for users, but we should still convert it to a normal
boolean internally.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-07-03 16:02:21 +02:00
parent 91907b066f
commit 91230d4eba

View file

@ -367,9 +367,11 @@ def main():
help="Print license mappings and exit")
parser.add_argument("--translate-license", action="store_true",
help="Print mapping for specified license and exit")
parser.add_argument("--no-auto-changelog-entry", action="store_true",
parser.add_argument("--no-auto-changelog-entry", action="store_false",
default=True, dest="auto_changelog_entry",
help="Do not generate a changelog entry")
parser.add_argument("--no-existence-check", action="store_true",
parser.add_argument("--no-existence-check", action="store_false",
default=True, dest="existence_check",
help="Do not check whether the package already exists in dist-git")
parser.add_argument("-", "--stdout", action="store_true",
help="Print spec and patches into stdout")
@ -459,7 +461,7 @@ def main():
kwargs["pkg_suffix"] = suffix
spec_file = pathlib.Path(f"rust-{metadata.name}{suffix}.spec")
if args.target in {"fedora"} and not args.no_existence_check and not os.path.exists(spec_file):
if args.target in {"fedora"} and args.existence_check and not os.path.exists(spec_file):
# No specfile, so this is probably a new package
package_info = get_package_info(f"rust-{metadata.name}{suffix}")
if package_info:
@ -467,7 +469,7 @@ def main():
print("Re-run with --no-existence-check if you still want to convert it.")
sys.exit(1)
kwargs["auto_changelog_entry"] = not args.no_auto_changelog_entry
kwargs["auto_changelog_entry"] = args.auto_changelog_entry
rpmautospec = args.rpmautospec
if rpmautospec is None: