Skip to content

Commit

Permalink
update init_private_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
xvzc committed Jan 6, 2024
1 parent 3861090 commit 92cd214
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 35 deletions.
39 changes: 18 additions & 21 deletions dot_scripts/executable_git-set
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,31 @@
HELP="usage: git set --user [username]"

while [[ $# -gt 0 ]]; do
case $1 in
-u|--user)
git_user="$2"
shift
shift
;;
-h|--help)
shift
echo $HELP
exit 1
;;
*)
shift # past argument
;;
esac
case $1 in
-u | --user)
git_user="$2"
shift
shift
;;
-h | --help)
shift
echo $HELP
exit 1
;;
*)
shift # past argument
;;
esac
done

if [ -z "$git_user" ]; then
echo $HELP
exit 1;
echo $HELP
exit 1
fi

# https://github.com/xvzc/dotfiles.git
origin=$(git remote get-url origin)
tokens=($(echo $origin | tr "/" "\n"))
repo=${tokens[${#tokens[@]}-1]}
echo $git_user
echo $repo
repo=${tokens[${#tokens[@]} - 1]}

git remote set-url --push origin "git@$git_user.github.com:$git_user/$repo"

2 changes: 2 additions & 0 deletions dot_zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ zmodload zsh/zprof

prompt pure


[ "$TMUX" = "" ] && (tns main || tat main) || return 0
17 changes: 5 additions & 12 deletions init_private_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,19 @@ error() {
exit 1
}

wait-1password() {
check-1password() {
if ! command -v op &>/dev/null; then
error "1Password not found"
fi

if ! op whoami 2>/dev/null; then
echo "Login 1password app"
open -a 1Password

until op signin 2>/dev/null; do
sleep 1
done
error "Login 1password app"
fi

if ! ssh-add -l &>/dev/null; then
echo "Setup 1password ssh-agent"

until ssh-add -l &>/dev/null; do
sleep 1
done
open -a 1Password
error "Setup 1password ssh-agent"
fi
}

Expand All @@ -45,7 +38,7 @@ elif [ "$cur_os" = "Linux" ]; then
font_dir=~/.local/share/fonts/
fi

wait-1password
check-1password

op read "op://Personal/SSH Github xvzc/public key" >~/.ssh/xvzc.pub &&
chmod 600 ~/.ssh/xvzc.pub
Expand Down
4 changes: 2 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ else
error "Cannot determine operating system."
fi

# install pynvim
pip3 install pynvim
bob install nightly
bob use nightly

0 comments on commit 92cd214

Please sign in to comment.