Add MVP `confirm', WIP `gut'
This commit is contained in:
parent
177c5b7ddc
commit
207a824e75
2
build.sh
2
build.sh
|
@ -35,7 +35,7 @@ bin() {
|
||||||
cbuild "$f"
|
cbuild "$f"
|
||||||
done
|
done
|
||||||
|
|
||||||
for f in src/pasta src/sign src/timestamp; do
|
for f in src/pasta src/sign src/timestamp src/confirm; do
|
||||||
fbuild "$f"
|
fbuild "$f"
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# confirm: get user confirmation
|
||||||
|
# author: Dylan Lom <djl@dylanlom.com>
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Dylan Lom <djl@dylanlom.com>
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||||
|
# with or without fee is hereby granted.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
|
# THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
truthy "$1" \
|
||||||
|
&& msg="$1" \
|
||||||
|
|| msg="Are you sure you want to do that?"
|
||||||
|
printf "%s [Y/n]: " "$msg"
|
||||||
|
read resp
|
||||||
|
test ! "$resp" = 'N' -a ! "$resp" = 'n'
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
#
|
||||||
|
# gut: git but gross
|
||||||
|
# author: Dylan Lom <djl@dylanlom.com>
|
||||||
|
#
|
||||||
|
# Copyright (C) 2021 Dylan Lom <djl@dylanlom.com>
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for any purpose
|
||||||
|
# with or without fee is hereby granted.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||||
|
# THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
# CHRISTMAS GIT MAGIC
|
||||||
|
add() {
|
||||||
|
truthy "$1" \
|
||||||
|
&& git add $1 \
|
||||||
|
#|| (for f in $(git status --porcelain | cut -c4-); do)
|
||||||
|
}
|
||||||
|
|
||||||
|
alias co='checkout'
|
||||||
|
checkout() {
|
||||||
|
truthy "$1" && target="$1" || target="$(git config init.defaultBranch)"
|
||||||
|
git checkout "$target"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
alias save='stash'
|
||||||
|
stash() {
|
||||||
|
truthy "$1" \
|
||||||
|
&& git stash push -m "$1" \
|
||||||
|
|| git stash push
|
||||||
|
}
|
||||||
|
|
||||||
|
# Is anything already staged
|
||||||
|
# then: commit that
|
||||||
|
# else: stage and commit everything
|
||||||
|
commit() {
|
||||||
|
status
|
||||||
|
git status --porcelain | grep '^[^ ]*A' \
|
||||||
|
&& git commit -a \
|
||||||
|
|| (git add . && git commit "$1")
|
||||||
|
}
|
||||||
|
|
||||||
|
amend() {
|
||||||
|
git commit --amend -a
|
||||||
|
}
|
||||||
|
|
||||||
|
push() {
|
||||||
|
git push $1
|
||||||
|
}
|
||||||
|
|
||||||
|
alias update='pull'
|
||||||
|
pull() {
|
||||||
|
git pull $1
|
||||||
|
}
|
||||||
|
|
||||||
|
status() {
|
||||||
|
git status --short
|
||||||
|
}
|
||||||
|
|
||||||
|
diff() {
|
||||||
|
git diff $1
|
||||||
|
}
|
||||||
|
|
||||||
|
$@
|
Loading…
Reference in New Issue