fix site creator not working with full paths by using a temporary chdir

fix grammar issue in site creator
This commit is contained in:
Kevin 2020-06-13 17:49:16 -05:00
parent 33896d9c91
commit 2a65f605f5

View File

@ -3,6 +3,7 @@
Command to create Onionr mutli-page sites Command to create Onionr mutli-page sites
""" """
import sys import sys
import os
import getpass import getpass
from httpapi import onionrsitesapi from httpapi import onionrsitesapi
@ -27,8 +28,11 @@ from etc import onionrvalues
def create_multipage_site(): def create_multipage_site():
"""Command to create mutlipage sites with specified dir and password.""" """Command to create mutlipage sites with specified dir and password."""
error_encountered = False error_encountered = False
orig_dir = os.getcwd()
try: try:
directory = sys.argv[2] directory = sys.argv[2]
os.chdir(directory)
directory = '.'
except IndexError: except IndexError:
directory = '.' directory = '.'
try: try:
@ -61,6 +65,7 @@ If you want to update your site later you must remember the passphrase.''',
results = (results[0].replace('=', ''), results[1]) results = (results[0].replace('=', ''), results[1])
logger.info(f'Site address {results[0]}', terminal=True) logger.info(f'Site address {results[0]}', terminal=True)
logger.info(f'Block for this version {results[1]}', terminal=True) logger.info(f'Block for this version {results[1]}', terminal=True)
os.chdir(orig_dir)
create_multipage_site.onionr_help = "[directory path " # type: ignore create_multipage_site.onionr_help = "[directory path " # type: ignore