Move find command into function + minor changes
This commit is contained in:
parent
5ff81a4091
commit
4200ea9613
1 changed files with 6 additions and 7 deletions
|
@ -66,9 +66,6 @@ clitip() {
|
||||||
xmlstarlet unesc | fmt -80 | iconv -t US
|
xmlstarlet unesc | fmt -80 | iconv -t US
|
||||||
}
|
}
|
||||||
|
|
||||||
#GIT_REPOS=($(find ~ -name .git -type d -not -path '*/.vim/*' -and -not -path '*/.local/*' -and -not -path '*/builds/*' -exec dirname {} \;))
|
|
||||||
GIT_REPOS=(~/src/* ~/setup-cockpit ~/tssr ~/.password-store)
|
|
||||||
|
|
||||||
cockpit() { # enable pass-like commands (ex: cockpit git push)
|
cockpit() { # enable pass-like commands (ex: cockpit git push)
|
||||||
local start_dir="$PWD"
|
local start_dir="$PWD"
|
||||||
cd ~/setup-cockpit && "$@"
|
cd ~/setup-cockpit && "$@"
|
||||||
|
@ -90,13 +87,14 @@ system_update() {
|
||||||
|
|
||||||
aur_update() {
|
aur_update() {
|
||||||
local start_dir="$PWD"
|
local start_dir="$PWD"
|
||||||
for repo in $(find ~/builds -name .git -type d -exec dirname {} \;); do
|
local aur_packages; aur_packages=($(find ~/builds -name .git -type d -exec dirname {} \;))
|
||||||
|
for repo in "${aur_packages[@]}"; do
|
||||||
cd && cd "$repo" && git fetch -q
|
cd && cd "$repo" && git fetch -q
|
||||||
local unpulled=$(git log --pretty=format:'%h' ..@{u} | wc -c)
|
local unpulled; unpulled=$(git log --pretty=format:'%h' '..@{u}' | wc -c)
|
||||||
if [ "$unpulled" -eq 0 ]; then
|
if [ "$unpulled" -eq 0 ]; then
|
||||||
echo "$(basename "$repo") is up to date"
|
echo "$(basename "$repo") is up to date"
|
||||||
else
|
else
|
||||||
git pull && git log --no-merges --oneline --stat @{1}.. -p
|
git pull && git log --no-merges --oneline --stat '@{1}..' -p
|
||||||
echo -n "Update $repo? [y/N] "
|
echo -n "Update $repo? [y/N] "
|
||||||
read -r answer
|
read -r answer
|
||||||
if [ ! "$answer" = 'y' ]; then
|
if [ ! "$answer" = 'y' ]; then
|
||||||
|
@ -111,7 +109,8 @@ aur_update() {
|
||||||
|
|
||||||
pull_from_repos() {
|
pull_from_repos() {
|
||||||
local start_dir="$PWD"
|
local start_dir="$PWD"
|
||||||
for repo in "${GIT_REPOS[@]}"; do
|
local git_repos; git_repos=($(find ~ -name .git -type d -not -path '*/.vim/*' -and -not -path '*/.local/*' -and -not -path '*/builds/*' -exec dirname {} \;))
|
||||||
|
for repo in "${git_repos[@]}"; do
|
||||||
echo "Pulling from $repo..."
|
echo "Pulling from $repo..."
|
||||||
cd "$repo" && git pull
|
cd "$repo" && git pull
|
||||||
done
|
done
|
||||||
|
|
Loading…
Add table
Reference in a new issue