Compare commits
No commits in common. "6690c470e35053aab13911c95b100b0c81de8402" and "8a340366bffa288eb735bdf4b125e7788e335018" have entirely different histories.
6690c470e3
...
8a340366bf
5 changed files with 13 additions and 38 deletions
|
|
@ -66,7 +66,6 @@ It was inspired by [[https://wiki.ros.org/wstool][wstool]], [[https://github.com
|
|||
! - Local changes
|
||||
+ - Staged changes
|
||||
- - File removed
|
||||
» - File renamed
|
||||
= - Both modified
|
||||
⇕ - Diverged from upstream
|
||||
⇡ - Ahead upstream
|
||||
|
|
|
|||
6
flake.lock
generated
6
flake.lock
generated
|
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709101946,
|
||||
"narHash": "sha256-TsySgcWm/GlbYdL3AEva49ceeI2BdPQ7muwfYNr1fwo=",
|
||||
"lastModified": 1694760568,
|
||||
"narHash": "sha256-3G07BiXrp2YQKxdcdms22MUx6spc6A++MSePtatCYuI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d53c2037394da6fe98decca417fc8fda64bf2443",
|
||||
"rev": "46688f8eb5cd6f1298d873d4d2b9cf245e09e88e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
|||
24
gis
24
gis
|
|
@ -52,7 +52,7 @@ while (( "$#" )); do
|
|||
exit 0
|
||||
;;
|
||||
-*)
|
||||
error "Unsupported option ${text_bold}$1${text_reset}"
|
||||
error "Unsupported option ${text_bold}$1${text_bold}"
|
||||
;;
|
||||
fetch)
|
||||
fetch=true
|
||||
|
|
@ -120,7 +120,7 @@ if [ "$fetch" == true ]; then
|
|||
repository_name=$(basename "$dir")
|
||||
|
||||
# Fetch all Git repositories in background
|
||||
git fetch --prune --all 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_blue}${repository_name}${text_reset} /") &
|
||||
git fetch --prune --all 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_blue}${repository_name}${text_reset} /" >&2) &
|
||||
fetch_pids+=("$!")
|
||||
done
|
||||
|
||||
|
|
@ -157,7 +157,7 @@ if [ "$pull" == true ]; then
|
|||
# Get repository name
|
||||
repository_name=$(basename "$dir")
|
||||
|
||||
git pull > >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_magenta}${repository_name}${text_reset} /") &
|
||||
git pull 1> /dev/null 2> >(trap 'kill $! 2> /dev/null' INT TERM; sed "s/^/${text_bold}${text_magenta}${repository_name}${text_reset} /" >&2) &
|
||||
pull_pids+=("$!")
|
||||
done
|
||||
|
||||
|
|
@ -197,12 +197,8 @@ for dir in "${git_dirs[@]}"; do
|
|||
|
||||
# Get status
|
||||
remote_status_keys=""
|
||||
has_upstream=true
|
||||
while read -r status; do
|
||||
if [[ "$status" =~ ^\#\#\ (.*) ]] && [ "$(git remote | wc -l)" -gt 0 ]; then
|
||||
[[ "${BASH_REMATCH[1]}" != *"..."* ]] && has_upstream=false
|
||||
fi
|
||||
if [[ "$status" =~ ^\#\#.*\ \[(.*)\] ]]; then
|
||||
if [[ "$status" =~ ^\#\#.*\[(.*)\] ]]; then
|
||||
[[ "${BASH_REMATCH[1]}" == *"ahead"* ]] && [[ "${BASH_REMATCH[1]}" == *"behind"* ]] && remote_status_keys="⇕" && continue
|
||||
[[ "${BASH_REMATCH[1]}" == *"ahead"* ]] && remote_status_keys="⇡" && continue
|
||||
[[ "${BASH_REMATCH[1]}" == *"behind"* ]] && remote_status_keys="⇣" && continue
|
||||
|
|
@ -219,7 +215,6 @@ for dir in "${git_dirs[@]}"; do
|
|||
status_keys="${status_keys//D/-}"
|
||||
status_keys="${status_keys//M/!}"
|
||||
status_keys="${status_keys//U/=}"
|
||||
status_keys="${status_keys//R/»}"
|
||||
|
||||
# Update all status keys
|
||||
all_status_keys="${all_status_keys}${status_keys}"
|
||||
|
|
@ -234,17 +229,11 @@ for dir in "${git_dirs[@]}"; do
|
|||
output="${output}${repository_name};${status_keys}"
|
||||
|
||||
# Construct branch output
|
||||
if [ "$current_branch" == "$origin_head" ]; then
|
||||
if [ "$current_branch" = "$origin_head" ]; then
|
||||
output="${output};${text_bold}${current_branch}${text_reset}"
|
||||
else
|
||||
output="${output};${text_bold}${text_yellow}${current_branch}${text_reset}"
|
||||
fi
|
||||
if [ "$has_upstream" == false ]; then
|
||||
output="${output} ${text_blue}[no upstream]${text_reset}"
|
||||
fi
|
||||
if [ "$current_branch" != "$origin_head" ]; then
|
||||
num_additional_branches=$(( num_additional_branches - 1 ))
|
||||
output="${output} (${origin_head}${text_reset})"
|
||||
output="${output};${text_bold}${text_yellow}${current_branch}${text_reset} (${origin_head}${text_reset})"
|
||||
fi
|
||||
if [[ $num_additional_branches -gt 0 ]]; then
|
||||
output="${output} (+${num_additional_branches})"
|
||||
|
|
@ -262,7 +251,6 @@ if [[ "$all_status_keys" ]]; then
|
|||
[[ "$all_status_keys" == *"!"* ]] && echo " ${text_bold}${text_red}!${text_reset} - Local changes"
|
||||
[[ "$all_status_keys" == *"+"* ]] && echo " ${text_bold}${text_red}+${text_reset} - Staged changes"
|
||||
[[ "$all_status_keys" == *"-"* ]] && echo " ${text_bold}${text_red}-${text_reset} - File removed"
|
||||
[[ "$all_status_keys" == *"»"* ]] && echo " ${text_bold}${text_red}»${text_reset} - File renamed"
|
||||
[[ "$all_status_keys" == *"="* ]] && echo " ${text_bold}${text_red}=${text_reset} - Both modified"
|
||||
[[ "$all_status_keys" == *"⇕"* ]] && echo " ${text_bold}${text_red}⇕${text_reset} - Diverged from upstream"
|
||||
[[ "$all_status_keys" == *"⇡"* ]] && echo " ${text_bold}${text_red}⇡${text_reset} - Ahead upstream"
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Check 'column' dependency
|
||||
if ! command -v column &> /dev/null; then
|
||||
echo "Command 'column' not available on the system, please make sure all dependencies are fulfilled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adds $1 to ~/.bashrc if not already present
|
||||
function _add_to_config {
|
||||
if ! grep "$1" ~/.bashrc > /dev/null; then
|
||||
|
|
|
|||
12
install.zsh
12
install.zsh
|
|
@ -1,11 +1,5 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Check 'column' dependency
|
||||
if ! command -v column &> /dev/null; then
|
||||
echo "Command 'column' not available on the system, please make sure all dependencies are fulfilled."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Adds $1 to ~/.zshrc if not already present
|
||||
function _add_to_config {
|
||||
if ! grep "$1" ~/.zshrc > /dev/null; then
|
||||
|
|
@ -16,9 +10,9 @@ function _add_to_config {
|
|||
# Link files
|
||||
basedir="$(dirname "$(realpath "$0")")"
|
||||
mkdir -p ~/.local/{bin,share/bash-completion/completions}
|
||||
ln -fs "${basedir}/gis" ~/.local/bin/gis
|
||||
ln -frs "${basedir}/gis" ~/.local/bin/gis
|
||||
echo "Created link '~/.local/bin/gis'"
|
||||
ln -fs "${basedir}/gis_completion.bash" ~/.local/share/bash-completion/completions/gis
|
||||
ln -frs "${basedir}/gis_completion.bash" ~/.local/share/bash-completion/completions/gis
|
||||
echo "Created link '~/.local/share/bash-completion/completions/gis'"
|
||||
|
||||
# Modify config
|
||||
|
|
@ -26,7 +20,7 @@ touch ~/.zshrc
|
|||
_add_to_config "export PATH=\$PATH:${HOME}/.local/bin"
|
||||
_add_to_config "autoload -U +X compinit && compinit"
|
||||
_add_to_config "autoload -U +X bashcompinit && bashcompinit"
|
||||
_add_to_config "source ${HOME}/.local/share/bash-completion/completions/gis"
|
||||
_add_to_config "source /home/${USER}/.local/share/bash-completion/completions/gis"
|
||||
echo "Updated '~/.zshrc'"
|
||||
|
||||
echo
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue