Compare commits
2 Commits
python-rew
...
main
Author | SHA1 | Date | |
---|---|---|---|
fad0555960 | |||
ae6a433484 |
16
sssg/cli.py
16
sssg/cli.py
@ -5,7 +5,10 @@ import sys
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
def main(args=sys.argv):
|
def main(args=sys.argv):
|
||||||
|
try:
|
||||||
command = args[1]
|
command = args[1]
|
||||||
|
except IndexError:
|
||||||
|
command = "nonexistent"
|
||||||
|
|
||||||
if command == "rebuild":
|
if command == "rebuild":
|
||||||
cwd = os.getcwd()
|
cwd = os.getcwd()
|
||||||
@ -15,3 +18,16 @@ def main(args=sys.argv):
|
|||||||
os.execv('/bin/sh', ['/bin/sh', '.deploy'])
|
os.execv('/bin/sh', ['/bin/sh', '.deploy'])
|
||||||
elif command == "update":
|
elif command == "update":
|
||||||
sssg.liveupdate.liveupdate()
|
sssg.liveupdate.liveupdate()
|
||||||
|
else:
|
||||||
|
help_text = """
|
||||||
|
sssg - the stupid static site generator
|
||||||
|
|
||||||
|
usage: sssg [verb]
|
||||||
|
|
||||||
|
verb: one of
|
||||||
|
rebuild -- rebuilds the static site into output/
|
||||||
|
deploy -- executes the deploy script
|
||||||
|
update -- rebuild the static site upon any change
|
||||||
|
"""
|
||||||
|
|
||||||
|
print(help_text)
|
||||||
|
@ -42,8 +42,8 @@ BlogConverter = BasicConverter
|
|||||||
|
|
||||||
class BinaryConverter(Converter):
|
class BinaryConverter(Converter):
|
||||||
def realize_to_output(self: Self):
|
def realize_to_output(self: Self):
|
||||||
with open(self.document.file_path, "r") as origin:
|
with open(self.document.file_path, "rb") as origin:
|
||||||
with open(self.document.result_path, "w") as target:
|
with open(self.document.result_path, "wb") as target:
|
||||||
target.write(origin.read())
|
target.write(origin.read())
|
||||||
|
|
||||||
class SensibleConverterConfiguration(ConverterConfiguration):
|
class SensibleConverterConfiguration(ConverterConfiguration):
|
||||||
|
Loading…
Reference in New Issue
Block a user