In website, cd to root of website repo before proceeding
This commit is contained in:
parent
a5927fbc9a
commit
342a4af782
1 changed files with 7 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue