Skip to content

Commit

Permalink
default to Hugo
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Jun 23, 2019
1 parent 54ace61 commit ed4f9cf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 6 additions & 5 deletions ActOnChanged.py
Expand Up @@ -6,23 +6,24 @@
"""
import webbrowser
from pathlib import Path
from gitutils import listchanged
from gitutils.git import listchanged
from argparse import ArgumentParser


def main():
p = ArgumentParser()
p.add_argument('path', help='git directory to operate on')
p.add_argument('-j', '--jekyll', help='web browser preview of localhost', action='store_true')
p.add_argument('-p', '--preview', help='web browser preview of localhost', action='store_true')
p.add_argument('--port', help='port of localhost web server (Jekyll: 4000, Hugo: 1313)', type=int, default=1313)
P = p.parse_args()

path = Path(P.path).expanduser().resolve()
flist = listchanged(path)
# %%
if P.jekyll:
prefix = 'http://localhost:4000/'
if P.preview:
prefix = 'http://localhost:{}/'.format(P.port)

if path.name == '_posts':
if path.name == '_posts': # Jekyll with leading date in filename
cut = 11
else:
cut = 0
Expand Down
4 changes: 1 addition & 3 deletions gitutils/git.py
Expand Up @@ -100,6 +100,4 @@ def listchanged(path: Path) -> List[str]:
ret = subprocess.check_output([GITEXE, '-C', str(path), 'ls-files', '--modified'],
universal_newlines=True)

changes = ret.split('\n')

return changes
return ret.split('\n')

0 comments on commit ed4f9cf

Please sign in to comment.