updates
This commit is contained in:
@@ -5,4 +5,4 @@ spawn="niri msg action spawn --"
|
|||||||
$spawn codium --enable-features=UseOzonePlatform,WaylandWindowDecorations \
|
$spawn codium --enable-features=UseOzonePlatform,WaylandWindowDecorations \
|
||||||
--ozone-platform=wayland --new-window $HOME/projects/HR/rts10_reports/
|
--ozone-platform=wayland --new-window $HOME/projects/HR/rts10_reports/
|
||||||
# $spawn flatpak run md.obsidian.Obsidian file://$HOME/projects/hr/rts10_reports/
|
# $spawn flatpak run md.obsidian.Obsidian file://$HOME/projects/hr/rts10_reports/
|
||||||
$spawn open obsidain://open?vault=$HOME/projects/HR/rts10_reports/
|
$spawn open obsidian://open?vault=$HOME/projects/HR/rts10_reports/
|
||||||
|
|||||||
@@ -1,23 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
token="$1"
|
|
||||||
page=1
|
|
||||||
project_dir="$HOME/projects"
|
project_dir="$HOME/projects"
|
||||||
|
|
||||||
base_url="https://gitea.finnvanreenen.nl/api/v1"
|
|
||||||
|
|
||||||
function process_repo() {
|
function process_repo() {
|
||||||
json="$1"
|
local json="$1"
|
||||||
|
local remote_name="$2"
|
||||||
|
|
||||||
checkout="$project_dir"
|
local checkout="$project_dir"
|
||||||
|
|
||||||
if [[ "$(echo "$json" | jq -r '.name')" == 'dotfiles' ]]; then
|
if [[ "$(echo "$json" | jq -r '.name')" == 'dotfiles' ]]; then
|
||||||
return # do not clone dotfiles
|
return # do not clone dotfiles
|
||||||
fi
|
fi
|
||||||
|
|
||||||
full_name="$(echo "$json" | jq -r '.full_name')"
|
local full_name="$(echo "$json" | jq -r '.full_name')"
|
||||||
clone_url="$(echo "$json" | jq -r '.clone_url')"
|
local clone_url="$(echo "$json" | jq -r '.clone_url')"
|
||||||
ssh_url="$(echo "$json" | jq -r '.ssh_url')"
|
local ssh_url="$(echo "$json" | jq -r '.ssh_url')"
|
||||||
|
|
||||||
echo "$full_name"
|
echo "$full_name"
|
||||||
|
|
||||||
@@ -32,16 +29,30 @@ function process_repo() {
|
|||||||
if [ -d "$checkout/$full_name" ]
|
if [ -d "$checkout/$full_name" ]
|
||||||
then
|
then
|
||||||
echo " already exists"
|
echo " already exists"
|
||||||
|
if [[ "$(git -C "$checkout/$full_name" remote | grep "^$remote_name\$")" == "" ]]
|
||||||
|
then
|
||||||
|
git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url"
|
||||||
|
else
|
||||||
|
git -C "$checkout/$full_name" remote set-url "$remote_name" "$ssh_url"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo " clone to $checkout/$full_name"
|
echo " clone to $checkout/$full_name"
|
||||||
url="$(echo "$clone_url" | sed "s|://|://$token@|")"
|
url="$(echo "$clone_url" | sed "s|://|://$token@|")"
|
||||||
git clone "$clone_url" "$project_dir/$full_name"
|
git clone "$url" "$checkout/$full_name"
|
||||||
git -C "$project_dir/$full_name" remote set-url origin "$ssh_url"
|
git -C "$checkout/$full_name" remote set-url origin "$ssh_url"
|
||||||
|
git -C "$checkout/$full_name" remote add "$remote_name" "$ssh_url"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while [[ $page -lt 50 ]]
|
function fetch_repos() {
|
||||||
do
|
local base_url="$1"
|
||||||
|
local remote_name="$2"
|
||||||
|
local token="$3"
|
||||||
|
|
||||||
|
local page=1
|
||||||
|
|
||||||
|
while [[ $page -lt 50 ]]
|
||||||
|
do
|
||||||
# echo
|
# echo
|
||||||
echo "get repo list page $page"
|
echo "get repo list page $page"
|
||||||
repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" \
|
repos="$(curl -X 'GET' "$base_url/user/repos?page=$page&token=$token" \
|
||||||
@@ -60,4 +71,8 @@ do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
page="$(( $page + 1 ))"
|
page="$(( $page + 1 ))"
|
||||||
done
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
fetch_repos https://gitea.finnvanreenen.nl/api/v1 tea "$(pass show gitea.finnvanreenen.nl/autoclone)"
|
||||||
|
fetch_repos https://git.gay/api/v1 gay "$(pass show git.gay/autoclone)"
|
||||||
|
|||||||
5
private_dot_local/bin/executable_flatrun
Normal file
5
private_dot_local/bin/executable_flatrun
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
app="$(flatpak list --app --columns=name,application | sed -e 's/\t/ (/' -e 's/$/)/' | fzf)"
|
||||||
|
|
||||||
|
flatpak run "$(echo "$app" | sed -e 's/^.*(\(.*\))$/\1/')"
|
||||||
78
private_dot_local/bin/executable_proj_fetch_all
Executable file
78
private_dot_local/bin/executable_proj_fetch_all
Executable file
@@ -0,0 +1,78 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function update_remote() {
|
||||||
|
local repo="$1"
|
||||||
|
|
||||||
|
for remote in $(git -C "$repo" remote 2>/dev/null)
|
||||||
|
do
|
||||||
|
local new_url="$(git -C "$repo" remote get-url "$remote" | sed -e 's|^https://FReenen:[0-9a-f]*@gitea.finnvanreenen.nl/|git@gitea.finnvanreenen.nl:|')"
|
||||||
|
git -C "$repo" remote set-url "$remote" "$new_url"
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
for repo in $(find $HOME/projects/ -type d -name '.git' | sed -e 's/ /%20;/g')
|
||||||
|
do
|
||||||
|
repo="$( echo "$repo" | sed -e 's/%20;/ /g' -e 's|/\.git$||' )"
|
||||||
|
git -C "$repo" fetch --all 1>/dev/null \
|
||||||
|
|| update_remote "$repo" \
|
||||||
|
|| { echo "failt to fetch $repo" ; echo ; }
|
||||||
|
|
||||||
|
changes=""
|
||||||
|
|
||||||
|
staged=""
|
||||||
|
unsgated=""
|
||||||
|
git diff --cached --exit-code &>/dev/null || staged="staged"
|
||||||
|
git diff --exit-code &>/dev/null || unsgated="unsgated"
|
||||||
|
|
||||||
|
if [[ ! -z "$staged" && ! -z "$unstaged" ]]
|
||||||
|
then
|
||||||
|
changes="staged and unstaged changes"
|
||||||
|
elif [[ ! -z "$unstaged" ]]
|
||||||
|
then
|
||||||
|
changes="unstaged changes"
|
||||||
|
elif [[ ! -z "$staged" ]]
|
||||||
|
then
|
||||||
|
changes="staged changes"
|
||||||
|
fi
|
||||||
|
|
||||||
|
remote=""
|
||||||
|
|
||||||
|
b=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
|
||||||
|
if [ "$b" != "" ]
|
||||||
|
then
|
||||||
|
behind=$(git rev-list HEAD...@{u} --ignore-submodules --count 2>/dev/null)
|
||||||
|
ahead=$(git rev-list @{u}...HEAD --ignore-submodules --count 2>/dev/null)
|
||||||
|
if [[ "$behind" > 0 && "$ahead" > 0 ]]
|
||||||
|
then
|
||||||
|
remote="merge with remote"
|
||||||
|
elif [[ "$behind" > 0 ]]
|
||||||
|
then
|
||||||
|
remote="push to remote"
|
||||||
|
elif [[ "$ahead" > 0 ]]
|
||||||
|
then
|
||||||
|
remote="pull from remote"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "$changes" || ! -z "$remote" ]]
|
||||||
|
then
|
||||||
|
echo "# $repo"
|
||||||
|
echo
|
||||||
|
|
||||||
|
if [[ ! -z "$changes" && ! -z "$remote" ]]
|
||||||
|
then
|
||||||
|
echo "has $changes and has to $remote"
|
||||||
|
elif [[ ! -z "$changes" ]]
|
||||||
|
then
|
||||||
|
echo "has $changes"
|
||||||
|
elif [[ ! -z "$remote" ]]
|
||||||
|
then
|
||||||
|
echo "has to $remote"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
done
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
[Context]
|
[Context]
|
||||||
filesystems=/home/freenen/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/vdhcoapp;
|
sockets=gpg-agent
|
||||||
|
filesystems=~/.local/share/vdhcoapp:ro;~/projects:ro;~/.local/tiCloudAgent;~/.local/share/browserpass;~/.password-store/;~/.gnupg
|
||||||
|
|||||||
Reference in New Issue
Block a user