Compare commits
5 Commits
c28f163394
...
56eb7cc206
Author | SHA1 | Date |
---|---|---|
Dylan Lom | 56eb7cc206 | |
Dylan Lom | 221059f759 | |
Dylan Lom | 4cf693abd0 | |
Dylan Lom | e5ab9fa976 | |
Dylan Lom | c879754b5d |
|
@ -0,0 +1,28 @@
|
|||
# djl-utils
|
||||
|
||||
*nix-style utilities
|
||||
|
||||
## Goals
|
||||
|
||||
* A collection of simple, well-documented CLI tools that follow *nix conventions
|
||||
* Minimal external dependencies, statically compilable
|
||||
* Standalone applications -- if only one tool is required the source code for
|
||||
that tool alone need be distributed.
|
||||
|
||||
**NOTICE** (2021-04-24): The project is still at a very early stage and these
|
||||
goals have not yet been achieved, as they were not the *original* goals of the
|
||||
project (eg. compilation/build process currently produces a .deb file)
|
||||
|
||||
## Tools
|
||||
|
||||
* **confirm**: Prompt user for confirmation and report response via exit code
|
||||
* **countdown**: Start a countdown timer
|
||||
* **gut**: Wrap/simplify common `git` actions
|
||||
* **line**: Extract line(s) from stdin
|
||||
* **pasta**: Simple ssh-based pastebin
|
||||
* **sign**: Generate signature for current user
|
||||
* **stopwatch**: Start a stopwatch timer
|
||||
* **suptime**: System uptime in terms of seconds, minutes, hours or days
|
||||
* **timestamp**: Current date-timestamps in common formats
|
||||
* **truthy**: Test if input is true-adjacent
|
||||
|
45
src/gut.sh
45
src/gut.sh
|
@ -17,11 +17,19 @@
|
|||
# THIS SOFTWARE.
|
||||
#
|
||||
|
||||
# CHRISTMAS GIT MAGIC
|
||||
root() {
|
||||
git rev-parse --show-toplevel
|
||||
}
|
||||
|
||||
whoami() {
|
||||
echo "$(git config user.name) ($(git config user.email))"
|
||||
}
|
||||
|
||||
add() {
|
||||
truthy "$1" \
|
||||
&& git add $1 \
|
||||
#|| (for f in $(git status --porcelain | cut -c4-); do)
|
||||
|| (for f in $(git status --porcelain | cut -c4-); do \
|
||||
confirm "Add $f?" && git add "$(root)/$f"; done)
|
||||
}
|
||||
|
||||
alias co='checkout'
|
||||
|
@ -38,35 +46,26 @@ stash() {
|
|||
|| git stash push
|
||||
}
|
||||
|
||||
# Is anything already staged
|
||||
# then: commit that
|
||||
# else: stage and commit everything
|
||||
# If anything already added (staged):
|
||||
# then commit that
|
||||
# else prompt user to stage then commit
|
||||
commit() {
|
||||
status
|
||||
git status --porcelain | grep '^[^ ]*A' \
|
||||
&& git commit -a \
|
||||
|| (git add . && git commit "$1")
|
||||
git status --porcelain | grep -q '^[^ ]*A' \
|
||||
&& git commit \
|
||||
|| (status; add; git commit)
|
||||
}
|
||||
|
||||
# If anything already added (staged):
|
||||
# then amend that
|
||||
# else amend all
|
||||
amend() {
|
||||
git commit --amend -a
|
||||
}
|
||||
|
||||
push() {
|
||||
git push $1
|
||||
}
|
||||
|
||||
alias update='pull'
|
||||
pull() {
|
||||
git pull $1
|
||||
git status --porcelain | grep -q '^[^ ]*A' \
|
||||
&& git commit --amend \
|
||||
|| git commit --amend -a
|
||||
}
|
||||
|
||||
status() {
|
||||
git status --short
|
||||
}
|
||||
|
||||
diff() {
|
||||
git diff $1
|
||||
}
|
||||
|
||||
$@
|
||||
|
|
Loading…
Reference in New Issue