diff options
author | Zhiming Wang <zmwangx@gmail.com> | 2016-01-25 14:01:50 -0800 |
---|---|---|
committer | Zhiming Wang <zmwangx@gmail.com> | 2016-01-25 14:07:45 -0800 |
commit | eab0401e74087002c67d0224e8426c9162680cce (patch) | |
tree | 46e4372554680f7213c73c97ac42ecca3f046134 | |
parent | 0a8e19669def5dc6f38c42f537d314907bc6e3d1 (diff) | |
download | my_new_personal_website-eab0401e74087002c67d0224e8426c9162680cce.tar.xz my_new_personal_website-eab0401e74087002c67d0224e8426c9162680cce.zip |
pyblog: Allow opening interactive shell when deploying
This almost always happens when I gendeploy: gen asks me to touch the
new post which I agree, but then the project root is dirty and I'm
greeted with the continue or not prompt, at which point I have no choice
but to open a new shell (or ^Z suspend the current job) to commit the
changes.
This commit allows to open an interactive shell in place when project
root is found to be dirty when deploying, which nicely solves the issue.
Closes #10.
Diffstat (limited to '')
-rwxr-xr-x | pyblog | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -1007,10 +1007,11 @@ def deploy(args): "to the source branch, since the SHA and title " "of the latest commit on the source branch will be " "incorporated into the commit message on " - "the deployment branch.\n") + "the deployment branch. Type s[hell] on the " + "next prompt to open an interactive shell.\n") sys.stderr.write(RESET) while True: - sys.stderr.write("Continue? [yN] ") + sys.stderr.write("Continue? [yNs] ") answer = input() if not answer: # default @@ -1022,6 +1023,15 @@ def deploy(args): elif answer.startswith(('n', 'N')): abort = True break + elif answer.startswith(('s', 'S')): + shell = (os.environ['SHELL'] if 'SHELL' in os.environ and os.environ['SHELL'] + else 'zsh') + subprocess.call(shell) + stilldirty = subprocess.check_output(["git", "status", "--porcelain"]) + if stilldirty: + sys.stderr.write(YELLOW) + sys.stderr.write("Project root is still dirty.\n") + sys.stderr.write(RESET) else: sys.stderr.write("Please answer yes or no.\n") if abort: |