get command can now get directory indices
parent
6a7f95e118
commit
2360b25d73
|
@ -170,10 +170,23 @@ def get(config, preview, preview_path, path):
|
||||||
if preview:
|
if preview:
|
||||||
read_path = preview_path
|
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])
|
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()
|
@main.command()
|
||||||
@click.option('--local-repo-path', default=LOCAL_REPOSITORY_PATH,
|
@click.option('--local-repo-path', default=LOCAL_REPOSITORY_PATH,
|
||||||
help='Path to shared wiki git repository.', type=WikiRepo(**DEFAULT_PATH_KWARGS))
|
help='Path to shared wiki git repository.', type=WikiRepo(**DEFAULT_PATH_KWARGS))
|
||||||
|
|
Loading…
Reference in New Issue