Add undelete function for git to shell_aliases.
Also add a little system info to sofi.
This commit is contained in:
parent
3fa1c08a53
commit
336b20e3e2
|
@ -74,6 +74,26 @@ function kubelog {
|
|||
kubectl logs -f "$pod"
|
||||
}
|
||||
|
||||
function undelete {
|
||||
local filename="$1"
|
||||
if test -f "$filename"; then
|
||||
echo "File already exists!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get all commit hashes for this file
|
||||
# Presumably, the one that deleted it was the most recent one :D
|
||||
local hashes="$(git log --all --format=format:%H -- "$filename" | head -n 2)"
|
||||
if [[ "$(echo $hashes | wc -l)" != "2" ]]; then
|
||||
echo "Expected at least two commits relating to this file!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Checkout the file from the commit before it was deleted
|
||||
local hash="$(echo $hashes | tail -n 1)"
|
||||
git checkout $hash -- $filename
|
||||
}
|
||||
|
||||
alias j='journalctl -xefu'
|
||||
alias hsearch='hearch'
|
||||
alias d='docker'
|
||||
|
|
|
@ -37,6 +37,13 @@ case $choice in
|
|||
echo "</dependency>"
|
||||
exit 0
|
||||
;;
|
||||
inf*)
|
||||
date
|
||||
echo
|
||||
free -h
|
||||
echo
|
||||
df -h | grep '/dev\|Filesystem'
|
||||
;;
|
||||
|
||||
*)
|
||||
qarg="$(echo "$query_string" | cut -c 5-)"
|
||||
|
|
|
@ -88,8 +88,13 @@ paste_emoji() {
|
|||
nohup xclip -selection clipboard <(echo -n $emoji) &> /dev/null &
|
||||
}
|
||||
|
||||
system_info() {
|
||||
echo "inf $(date)"
|
||||
}
|
||||
|
||||
if [[ "$1" == "--print-only" ]]; then
|
||||
cat \
|
||||
<(system_info) \
|
||||
<(windows) \
|
||||
<($HOME/.rofi-list-git-repos.py --no-icon) \
|
||||
<(read_apps) \
|
||||
|
@ -100,6 +105,7 @@ if [[ "$1" == "--print-only" ]]; then
|
|||
fi
|
||||
|
||||
choice="$(cat \
|
||||
<(system_info) \
|
||||
<(windows) \
|
||||
<("$HOME/.rofi-list-git-repos.py") \
|
||||
<(read_apps) \
|
||||
|
@ -161,6 +167,8 @@ case $choice in
|
|||
setsid xdg-open "$(echo $choice | cut -c 5- | sed "s@~@$HOME@")" &> /dev/null &
|
||||
;;
|
||||
|
||||
time*)
|
||||
;;
|
||||
*)
|
||||
case $qstring in
|
||||
mvn*)
|
||||
|
|
Loading…
Reference in New Issue