bin: adjust extra script features

This commit is contained in:
xeruf 2022-01-11 13:23:56 +01:00
parent bef11c21a1
commit f879fabc53
3 changed files with 10 additions and 7 deletions

View File

@ -182,11 +182,11 @@ alias lar='last | tac'
alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G' alias lst='( last; last -f /var/log/wtmp.1 ) | grep -v "pts/" | tac | less +G'
u() { u() {
topgrade --only emacs --yes
which pacman-mirrors >/dev/null && which pacman-mirrors >/dev/null &&
sudo pacman-mirrors --geoip && sudo pacman-mirrors --geoip &&
sudo pacman -Syy sudo pacman -Syy
topgrade topgrade
topgrade --only emacs --yes
} }
# Remote # Remote

View File

@ -1,15 +1,17 @@
#!/bin/sh -e #!/bin/sh -e
# Clones a fork and sets a corresponding upstream # Clones a fork and sets a corresponding upstream
# ARGS # ARGS
# - repo name # - repo name (omit if setting upstream in existing repo)
# - upstream user # - upstream user
# - local user # - local user
# - url # - url
# - target directory name (and further arguments to clone) # - target directory name (and further arguments to clone)
if test -d ".git" if test -d ".git"
then git remote set-url origin "$(git-repo "${4:-github.com}" "$1" "$3" "${@:5}")" then repo="$(basename "$PWD")"
else git-get "${4:-github.com}" "$1" "$3" "${@:5}" git remote set-url origin "$(git-repo "${3:-github.com}" "$repo" "$2" "${@:4}")"
cd $(expr "$5" \| "$1") else repo="$1"
git-get "${3:-github.com}" "$repo" "$2" "${@:4}"
cd $(expr "$5" \| "$1")
fi fi
test "$2" && git remote add upstream "$(git-repo "${4:-github.com}" "$1" "$2")" test "$1" && git remote add upstream "$(git-repo "${3:-github.com}" "$repo" "$1")"
git remote -v git remote -v

View File

@ -1,8 +1,9 @@
#!/bin/sh -e #!/bin/sh -e
# Add the modification date in front of the filename # Add the modification date in front of the filename
IFS='\n' IFS='\n'
test "$1" = -s && short=true && shift
for file for file
do mv --verbose --interactive "$file" \ do mv --verbose --interactive "$file" \
"$(latest "$file" | head -2 | tail -1 | cut -d'+' -f1)_$(echo "$file" | sed 's/20\([0-9]\{2\}\)-\([0-9]\{2\}\)\(-[0-9]\{2\}\)\?_\?//')" "$(latest "$file" | head -2 | tail -1 | cut -c$(test "$short" && echo "3,4,6,7,9,10" || echo "-10"))_$(echo "$file" | sed 's/2\?\([0-9]\{2,3\}\)-\([0-9]\{2\}\)\(-[0-9]\{2\}\)\?_\?//')"
done done
# stat --format %y "$file" | cut -d' ' -f1 # stat --format %y "$file" | cut -d' ' -f1