Update for compatibility with hy 0.9.12
This commit is contained in:
parent
8e599478f7
commit
f045a28463
2 changed files with 11 additions and 11 deletions
8
hypo.hy
8
hypo.hy
|
@ -44,12 +44,12 @@
|
||||||
|
|
||||||
(defun get-type [ext]
|
(defun get-type [ext]
|
||||||
(cond
|
(cond
|
||||||
((in ext (, ".jpg" ".jpeg" ".png" ".gif")) "image")
|
[(in ext (, ".jpg" ".jpeg" ".png" ".gif")) "image"]
|
||||||
(true "text")))
|
[True "text"]))
|
||||||
|
|
||||||
(defun read-file [filename]
|
(defun read-file [filename]
|
||||||
(let (res)
|
(let (res)
|
||||||
(with [f (file filename "r")]
|
(with [[f (file filename "r")]]
|
||||||
(setv res (f.read)))
|
(setv res (f.read)))
|
||||||
res))
|
res))
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ If no lexer is found fallback onto the text lexer."
|
||||||
(let ((h (hashes name))
|
(let ((h (hashes name))
|
||||||
(dirname (+ "files/" (get h 0))))
|
(dirname (+ "files/" (get h 0))))
|
||||||
(os.mkdir dirname)
|
(os.mkdir dirname)
|
||||||
(with [f (file (+ dirname "/" name) "w")]
|
(with [[f (file (+ dirname "/" name) "w")]]
|
||||||
(.write f (web.data)))
|
(.write f (web.data)))
|
||||||
(let ((repo (Gittle.init dirname)))
|
(let ((repo (Gittle.init dirname)))
|
||||||
(.stage repo [(str name)])
|
(.stage repo [(str name)])
|
||||||
|
|
14
hypoctl
14
hypoctl
|
@ -23,16 +23,16 @@
|
||||||
[description "Control hypo"]
|
[description "Control hypo"]
|
||||||
[run (lambda [self]
|
[run (lambda [self]
|
||||||
(cond
|
(cond
|
||||||
((not self.args)
|
[(not self.args)
|
||||||
(progn (print self.usage) 2))
|
(progn (print self.usage) 2)]
|
||||||
((= (car self.args) "start")
|
[(= (car self.args) "start")
|
||||||
(hypo-start (cdr self.args)))
|
(hypo-start (cdr self.args))]
|
||||||
(True
|
[True
|
||||||
(print (.format "error: command {0} does not exist"
|
(print (.format "error: command {0} does not exist"
|
||||||
(car self.args))))))]])
|
(car self.args)))]))]])
|
||||||
|
|
||||||
(when (= __name__ "__main__")
|
(when (= __name__ "__main__")
|
||||||
(let ((cmd (hypoctl-command (cdr (cdr sys.argv)))))
|
(let ((cmd (hypoctl-command (cdr sys.argv))))
|
||||||
(if cmd.error
|
(if cmd.error
|
||||||
(progn (print (.format "error: {0}" cmd.error))
|
(progn (print (.format "error: {0}" cmd.error))
|
||||||
(sys.exit 1))
|
(sys.exit 1))
|
||||||
|
|
Loading…
Reference in a new issue