get command can now get directory indices

master
nathaniel smith 2017-10-02 22:37:59 -07:00
parent 6a7f95e118
commit 2360b25d73
1 changed files with 14 additions and 1 deletions

View File

@ -170,10 +170,23 @@ def get(config, preview, preview_path, path):
if preview:
read_path = preview_path
path = os.path.join(read_path, path) + '.html'
path = os.path.join(read_path, path)
if os.path.exists(path)\
and os.path.isdir(path)\
and os.path.exists(os.path.join(path, 'index.html')):
path = os.path.join(path, 'index.html')
elif os.path.exists(path + '.html'):
path = path + '.html'
else:
raise ClickException("Couldn't find path {}".format(path))
subprocess.run(['sensible-browser', path])
# TODO sync command that:
# - offers to wipe any local changes or commit them
# - pulls from origin
# - pushes to origin
@main.command()
@click.option('--local-repo-path', default=LOCAL_REPOSITORY_PATH,
help='Path to shared wiki git repository.', type=WikiRepo(**DEFAULT_PATH_KWARGS))