Compare commits

...

1 Commits

Author SHA1 Message Date
Casey 45fb070665
Uh, some basic stuff 2022-11-03 18:24:30 +03:00
3 changed files with 56 additions and 0 deletions

View File

@ -0,0 +1,34 @@
from argparse import ArgumentParser, Namespace
from os.path import exists
from rich.prompt import Confirm
from rich import print
parser = ArgumentParser(
"mastoposter.mkconfig",
description="Configuration script for mastoposter",
epilog="For detailed description of configuration file, "
"visit https://github.com/hatkidchan/mastoposter",
)
parser.add_argument(
"-o", dest="output", required=True, help="Path of output file"
)
parser.add_argument(
"-f", dest="force", action="store_true", help="Force overwrite"
)
def main(args: Namespace):
if exists(args.output) and not args.force:
print("[red]File already exists. It will be overwritten in the end")
if not Confirm.ask("Continue?"):
return 1
# TODO
if __name__ == "__main__":
from sys import argv
exit(main(parser.parse_args(argv[1:])))

View File

@ -0,0 +1,19 @@
from abc import ABC, abstractmethod
from configparser import ConfigParser
class BaseBackend(ABC):
def __init__(self):
pass
@abstractmethod
def pre_run(self):
raise NotImplementedError
@abstractmethod
def configure(self):
raise NotImplementedError
@abstractmethod
def generate_config(self) -> ConfigParser:
raise NotImplementedError

View File

@ -2,6 +2,7 @@ anyio==3.6.1
beautifulsoup4==4.11.1 beautifulsoup4==4.11.1
bs4==0.0.1 bs4==0.0.1
certifi==2022.6.15 certifi==2022.6.15
commonmark==0.9.1
emoji==2.0.0 emoji==2.0.0
h11==0.12.0 h11==0.12.0
httpcore==0.15.0 httpcore==0.15.0
@ -10,7 +11,9 @@ idna==3.3
Jinja2==3.1.2 Jinja2==3.1.2
lxml==4.9.1 lxml==4.9.1
MarkupSafe==2.1.1 MarkupSafe==2.1.1
Pygments==2.13.0
rfc3986==1.5.0 rfc3986==1.5.0
rich==12.6.0
sniffio==1.2.0 sniffio==1.2.0
soupsieve==2.3.2.post1 soupsieve==2.3.2.post1
websockets==10.3 websockets==10.3