Compare commits

...

5 Commits

Author SHA1 Message Date
Dylan Lom 56eb7cc206 Add README.md 2021-04-24 21:48:57 +10:00
Dylan Lom 221059f759 Add gut whoami command 2021-04-24 21:00:56 +10:00
Dylan Lom 4cf693abd0 Tidy up gut commit some more, improve gut amend 2021-04-24 20:58:54 +10:00
Dylan Lom e5ab9fa976 Use internal add wrapper in commit 2021-04-24 20:50:33 +10:00
Dylan Lom c879754b5d Fix gut add and commit commands
* Add `gut root` command
* Remove alias commands (for now)
2021-04-24 20:46:02 +10:00
2 changed files with 50 additions and 23 deletions

28
README.md Normal file
View File

@ -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

View File

@ -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
}
$@