In website, cd to root of website repo before proceeding

This commit is contained in:
Eryn Wells 2025-10-06 08:16:06 -07:00
parent a5927fbc9a
commit 342a4af782

View file

@ -6,6 +6,7 @@ A Python interface to my personal website, Erynwells.me.
'''
import argparse
import os
import os.path as osp
from typing import List
from erynwells_me.scripting import Command
@ -34,6 +35,12 @@ def parse_args(commands: List[Command], argv, *a, **kw):
def main(argv):
program_name = osp.basename(argv[0])
args = parse_args(COMMANDS, argv[1:], prog=program_name)
scripts_dir = osp.dirname(__file__)
repo_root_dir = osp.normpath(osp.join(scripts_dir, '..'))
if os.getcwd() != repo_root_dir:
os.chdir(repo_root_dir)
return args.handler(args)