Add CLI options
This commit is contained in:
parent
cdfd3619f0
commit
556ad7a468
1 changed files with 10 additions and 2 deletions
12
main.py
12
main.py
|
@ -2,6 +2,7 @@ import feedparser
|
||||||
import json
|
import json
|
||||||
from markdownify import markdownify
|
from markdownify import markdownify
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,7 +29,14 @@ def split_notes(text: str, limit: int) -> list[str]:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config_file = open("./config.json", "r")
|
if len(sys.argv) < 3:
|
||||||
|
print("Usage:", sys.argv[0], "<account> <config>")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
account = sys.argv[1]
|
||||||
|
config_path = sys.argv[2]
|
||||||
|
|
||||||
|
config_file = open(config_path, "r")
|
||||||
config = json.load(config_file)
|
config = json.load(config_file)
|
||||||
config_file.close()
|
config_file.close()
|
||||||
|
|
||||||
|
@ -55,6 +63,6 @@ if __name__ == "__main__":
|
||||||
config[url] = time.mktime(rss.entries[-1].published_parsed)
|
config[url] = time.mktime(rss.entries[-1].published_parsed)
|
||||||
|
|
||||||
print("Saving config", config)
|
print("Saving config", config)
|
||||||
config_file = open("./config.json", "w")
|
config_file = open(config_path, "w")
|
||||||
json.dump(config, config_file, indent=4)
|
json.dump(config, config_file, indent=4)
|
||||||
config_file.close()
|
config_file.close()
|
||||||
|
|
Loading…
Reference in a new issue