Skip to content

Commit

Permalink
Merge pull request #7 from maksim77/master
Browse files Browse the repository at this point in the history
Change Popen argument to list
  • Loading branch information
akmittal authored Feb 27, 2018
2 parents 2c025e8 + 413db3c commit 4344fc8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Hugofy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ def setvars():
class HugonewsiteCommand(sublime_plugin.TextCommand):
def run(self, edit):
setvars()
process="hugo new site "+os.path.join(path,sitename)
process=["hugo", "new", "site", os.path.join(path,sitename)]
subprocess.Popen(process)

class HugonewcontentCommand(sublime_plugin.TextCommand):
def on_done(self,pagename):
if not pagename:
sublime.error_message("No filename provided")
process="hugo new "+pagename
process=["hugo", "new", pagename]
subprocess.Popen(process)
sublime.active_window().open_file(os.path.join(path,sitename,"content",pagename))
def on_change(self,filename):
Expand All @@ -44,7 +44,7 @@ def run(self,edit):
server=settings.get("Server")
theme=settings.get("DefaultTheme")
try:
startCmd = "hugo server --theme={} --buildDrafts --watch --port={}".format(theme, server["PORT"])
startCmd = ["hugo", "server", "--theme={}".format(theme), "--buildDrafts", "--watch", "--port={}".format(server["PORT"])]
out=subprocess.Popen(startCmd,stderr=subprocess.STDOUT,universal_newlines=True)
sublime.status_message('Server Started: {}'.format(startCmd))
except:
Expand All @@ -54,7 +54,7 @@ def run(self,edit):
class HugobuildCommand(sublime_plugin.TextCommand):
def run(self,edit):
try:
out=subprocess.Popen("hugo --buildDrafts",stdout=subprocess.PIPE)
out=subprocess.Popen(["hugo", "--buildDrafts"],stdout=subprocess.PIPE)
#print(out.communicate()[0].decode('utf-8'))
sublime.message_dialog(out.communicate()[0].decode('utf-8'))
except:
Expand All @@ -65,7 +65,7 @@ class HugogetthemesCommand(sublime_plugin.TextCommand):
def run(self,edit):
setvars()
try:
out=subprocess.Popen("git clone --recursive https://github.com/spf13/hugoThemes.git "+os.path.join(path,sitename,"themes"),stderr=subprocess.STDOUT,universal_newlines=True)
out=subprocess.Popen(["git", "clone", "--recursive", "https://github.com/spf13/hugoThemes.git", os.path.join(path,sitename,"themes")], stderr=subprocess.STDOUT,universal_newlines=True)
except:
sublime.error_message("git not installed or path not set")

Expand All @@ -85,4 +85,4 @@ def on_cancel(self):
def run(self,edit):
setvars()
sublime.active_window().show_input_panel("Enter theme name", "", self.on_done, self.on_change, self.on_cancel)

0 comments on commit 4344fc8

Please sign in to comment.