Created
March 21, 2018 09:46
-
-
Save ccfontes/13c22b9cc89795831d288f56373b67d4 to your computer and use it in GitHub Desktop.
On git commit, adds message with JIRA ticket name and time spent working on commit to the commit editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env hy | |
(import sys) | |
(import subprocess) | |
(import [pathlib [Path]]) | |
(import [functools [partial]]) | |
(setv current-branch-name (subprocess.check_output ["git" "symbolic-ref" "--short" "HEAD"] :encoding "utf-8")) | |
(setv work-time (subprocess.check_output ["glass" "-s" "status" "--commit-template"] :encoding "utf-8")) | |
(setv ticket_name (-> (.split current-branch-name "/") second (.split "_") first)) | |
(defn jira-cmds-to-file [tkt-name time filename] | |
(.write_text (Path filename) (+ tkt-name " " time " "))) | |
(if (-> sys.argv len (= 2)) | |
(jira-cmds-to-file ticket_name work-time (get sys.argv 1))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment