Remove double output, typo

This commit is contained in:
moanos [he/him] 2023-05-03 14:45:53 +02:00 committed by Gitea
parent 173aac081d
commit a646714f76

View File

@ -48,11 +48,6 @@ def remove_key_from_dict(dict, key):
def exporter(blocklist, output=None, format: str = "toml", private: bool = False): def exporter(blocklist, output=None, format: str = "toml", private: bool = False):
if format == "markdown": if format == "markdown":
exported_text = blocklist_to_markdown(blocklist, private) exported_text = blocklist_to_markdown(blocklist, private)
if output is not None:
with open(output, "w") as f:
f.write(exported_text)
else:
print(exported_text)
if format == "toml": if format == "toml":
exported_text = blocklist_to_toml(blocklist, private) exported_text = blocklist_to_toml(blocklist, private)
@ -80,7 +75,7 @@ def cli():
parser.add_argument('-v', '--verbose', action='store_true') parser.add_argument('-v', '--verbose', action='store_true')
parser.add_argument('-n', '--no-delete', action='store_true', help="Do not delete existing blocks") parser.add_argument('-n', '--no-delete', action='store_true', help="Do not delete existing blocks")
parser.add_argument('--format', help="Export format: toml|markdown") parser.add_argument('--format', help="Export format: toml|markdown")
parser.add_argument('--private', action='store_true', help="When the flag is set private comment will also be " parser.add_argument('--private', action='store_true', help="When the flag is set, private comment will also be "
"exported.") "exported.")
args = parser.parse_args() args = parser.parse_args()
if args.verbose: if args.verbose: