add new constants
to make things clearer
This commit is contained in:
parent
ffc3c7cdcf
commit
a727afe705
2 changed files with 18 additions and 13 deletions
|
@ -8,10 +8,12 @@ with open(cfg_file) as f:
|
|||
config = json.load(f)
|
||||
|
||||
WORKDIR = Path(config["workdir"])
|
||||
DIR_ASSETS = WORKDIR / config["dir_assets"]
|
||||
DIR_SOURCE = WORKDIR / config["dir_source"]
|
||||
DIR_HELPER = WORKDIR / config["dir_helper"]
|
||||
DIR_O_HTML = WORKDIR / config["dir_o_html"]
|
||||
GMI_FOOTER = WORKDIR / "footer.gmi"
|
||||
DIR_ASSETS = WORKDIR / config["dir_assets"]
|
||||
DIR_SOURCE = WORKDIR / config["dir_source"]
|
||||
DIR_HELPER = WORKDIR / config["dir_helper"]
|
||||
DIR_O_HTML = WORKDIR / config["dir_o_html"]
|
||||
GMI_FOOTER = WORKDIR / "footer.gmi"
|
||||
|
||||
RPORT = config["port"]
|
||||
REM_HTML = config["rem_html"]
|
||||
REM_GMI = config["rem_gmi"]
|
||||
RPORT = config["port"]
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
import typer
|
||||
import subprocess
|
||||
import shlex
|
||||
from gmirator import WORKDIR, RPORT
|
||||
from gmirator import (
|
||||
DIR_SOURCE,
|
||||
DIR_O_HTML,
|
||||
REM_HTML,
|
||||
REM_GMI,
|
||||
RPORT
|
||||
)
|
||||
|
||||
app = typer.Typer(help="syncs your files with configured remote")
|
||||
|
||||
@app.command("gmi")
|
||||
def sync_gmi():
|
||||
print("Synchronising GMI content with remote...")
|
||||
LGMI = WORKDIR / "content"
|
||||
RGMI = config["rem_gmi"]
|
||||
print(f'rsync -aP -e "ssh -p {RPORT}" {DIR_SOURCE} {REM_GMI}')
|
||||
subprocess.call(
|
||||
shlex.split(f'rsync -aP -e "ssh -p {RPORT}" {LGMI} {RGMI}')
|
||||
shlex.split(f'rsync -aP -e "ssh -p {RPORT}" {DIR_SOURCE} {REM_GMI}')
|
||||
)
|
||||
print("Done!")
|
||||
|
||||
@app.command("html")
|
||||
def sync_html():
|
||||
print("Synchronising HTML content with remote...")
|
||||
LHTML = WORKDIR / config["dir_o_html"]
|
||||
RHTML = config["rem_html"]
|
||||
subprocess.call(
|
||||
shlex.split(f'rsync -aP -e "ssh -p {RPORT}" {LHTML} {RHTML}')
|
||||
shlex.split(f'rsync -aP -e "ssh -p {RPORT}" {DIR_O_HTML} {REM_HTML}')
|
||||
)
|
||||
print("Done!")
|
||||
|
|
Loading…
Reference in a new issue