diff --git a/cloneall.bash b/cloneall.bash old mode 100644 new mode 100755 index df5912f56f1ecfd525a9381b9eefd4e1c86de853..d5a8d6102a29534f2c87efeb2797499c2755d894 --- a/cloneall.bash +++ b/cloneall.bash @@ -1,25 +1,31 @@ #!/bin/bash set -vex -REPOS=(gitlab-profile core io integrate octree domain PM) -SESSION_NAME=how +REPOS=(${REPOS:=gitlab-profile core io integrate octree domain PM}) +: ${SESSION_NAME:=hw} -while getopts "csapt" opt + +while getopts "cptlr:" opt do case "$opt" in c ) clona=1 ;; - s ) tmuxa=1 ;; - a ) attaccha=1 ;; - p ) installa=1 ;; - t ) testa=1 ;; + p ) pyinsta=1 ;; + t ) tmuxa=1 ;; + l ) linka=1 ;; + r ) shift $(( OPTIND - 2 )) && REPOS=($@) && break esac done -if [ -z "$clona" ] && [ -z "$tmuxa" ] && [ -z "$attaccha" ];then - echo 'usage: ./cloneall.bash -c (clone repos) -p (pip install) -t (python tests) -s (create screen tmux session) -a (attach to tmux)' +if [ -z "$clona" ] && [ -z "$pyinsta" ] && [ -z "$tmuxa" ] && [ -z "$linka" ];then + echo 'usage: ./cloneall.bash -c (clone repos) -p (python install and tests) -t (attach to tmux) -l (full tree of links) -r (repos)' exit 1 fi +for REPO in "${REPOS[@]}"; do + echo [ $REPO ] +done +#exit 0 + if [ ! -z "$clona" ]; then [[ ! -d "venv" ]] && python3 -mvenv venv . venv/bin/activate @@ -33,18 +39,33 @@ if [ ! -z "$clona" ]; then pushd $REPO git switch dev || echo no dev branch if [[ "$REPO" != "gitlab-profile" ]]; then - [ ! -z "$installa" ] && python -mpip install -e . - [ ! -z "$testa" ] && python -m hotwheels.checkup hotwheels/ + [ ! -z "$pyinsta" ] && python -mpip install -e . && python -m hotwheels.checkup hotwheels/ fi popd done fi +if [ ! -z "$linka" ]; then + mkdir -p full/hotwheels + touch full/hotwheels/__init__.py || echo cant touch + for f in core/hotwheels/*; do + [[ "${f##*/:0:2}" == "__" ]] && continue + ln -sf $PWD/$f full/hotwheels/${f##*/} + done + for REPO in "${REPOS[@]}"; do + if [ "$REPO" != "core" ] && [ "$REPO" != "gitlab-profile" ]; then + ln -sf $PWD/$REPO/hotwheels/$REPO full/hotwheels/$REPO + fi + done +fi + if [ ! -z "$tmuxa" ]; then if ! tmux has-session -t $SESSION_NAME ; then # Create a new tmux session tmux new-session -d -s $SESSION_NAME -c $PWD + + [[ -d full ]] && REPOS+=(full) for index in "${!REPOS[@]}"; do value="${REPOS[index]}" @@ -57,9 +78,6 @@ if [ ! -z "$tmuxa" ]; then tmux new-window -t $SESSION_NAME -c $PWD done fi -fi - -if [ ! -z "$attaccha" ]; then tmux attach-session -t $SESSION_NAME fi