From 822dab609016be3c560f299d7c9a0ca2d8c46c2b Mon Sep 17 00:00:00 2001 From: Luca Bilke <luca@bil.ke> Date: Sat, 17 Feb 2024 17:57:36 +0100 Subject: [PATCH] remove old clonedev script, add WIP warning to new --- .local/bin/clonedev.pl | 4 + .local/bin/clonedev.sh | 167 ----------------------------------------- 2 files changed, 4 insertions(+), 167 deletions(-) delete mode 100755 .local/bin/clonedev.sh diff --git a/.local/bin/clonedev.pl b/.local/bin/clonedev.pl index b7526a77..294dccb8 100755 --- a/.local/bin/clonedev.pl +++ b/.local/bin/clonedev.pl @@ -6,6 +6,10 @@ # TODO: Move update hooks to the actual .git/hooks directory # +print("This shit ain't done yet!"); +exit; + + use strict; use warnings; use feature ("signatures"); diff --git a/.local/bin/clonedev.sh b/.local/bin/clonedev.sh deleted file mode 100755 index 96cb0a3e..00000000 --- a/.local/bin/clonedev.sh +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/sh -# TODO: Rewrite this in a proper language -set -eu -list() { - # shellcheck disable=2086 - curl -s -X "GET" \ - "$1" \ - $HEADERS | - jq -r "$FILTER" -} - -_VAR_REGEX='(?<=^DEVDIRS_)[A-Za-z_-]*(?==)' -get_path() { - reponame=$(echo "$1" | rev | cut -d '/' -f 1 | rev) - echo " $BLOCK_REPOS " | grep -q " $reponame " && return 1 - for var in $(env | grep -oP "$_VAR_REGEX"); do - repos=$(eval "echo \$DEVDIRS_$var | xargs -r") - dir=$(echo "$var" | cut -d '_' -f 2) - if echo " $repos " | grep -q " $reponame "; then - return - fi - done - if ! $BLOCK_UNSORTED; then - echo "$BASE/unsorted/$reponame" - return - fi -} - -warn() { - tput el - tput setaf 1 - tput bold - echo "$@" - tput sgr0 -} - -info() { - tput el - tput setaf 4 - tput bold - echo "$@" - tput sgr0 -} - -success() { - tput el - tput setaf 2 - tput bold - echo "$@" - tput sgr0 -} - -scroll() { - # info "executing $*" - tput setaf 8 - tput sc - while read -r line; do - tput el - echo "$line" - tput rc - done - tput sgr0 -} - -# pull() { -# -# } -# -# clone() { -# -# } - -# FIX: pulling isn't functional yet -ensure() { - repo=$1 - dir=$(get_path "$repo") || { - warn "$repo blocked ✗" - return - } - [ -z "$dir" ] && return - if [ -d "$dir/.git" ]; then - git -C "$dir" status | grep -iq 'working tree clean' || { - warn "$repo unclean tree " - git -C "$dir" status | tail -n=+3 | head -n=+2 - return - } - tput sc - info "$repo getting pulled " - git -C "$dir" pull 2>&1 | scroll || { - tput rc - warn "$repo pull failed " - return - } - tput el - tput cuu1 - success "$repo pulled " - target=$(echo "$repo" | rev | cut -d'/' -f1 | rev) - if [ -x "$config_dir/hooks/update/$target" ]; then - cd "$dir" - tput sc - info "Running $target update hook" - "$config_dir/hooks/update/$target" | scroll || { - warn "failed to run update hook for $target ✗" - } - tput el - tput cuu1 - success "Ran $target update hook successfully ✓" - cd - - fi - return - fi - mkdir -p "$dir" || { - warn "mkdir -p $dir failed ✗" - return - } - tput sc - info "$repo getting cloned " - # shellcheck disable=2086 - git clone $CLONE_FLAGS "$repo" "$dir" 2>&1 | scroll || { - tput rc - warn "$repo clone failed ✗" - return - } - tput el - tput cuu1 - success "$repo cloned " - target=$(echo "$repo" | rev | cut -d'/' -f1 | rev) - if [ -x "$config_dir/hooks/install/$target" ]; then - cd "$dir" - tput sc - info "Running $target install hook" - "$config_dir/hooks/install/$target" | scroll || { - warn "failed to run install hook for $target ✗" - } - tput el - tput cuu1 - success "Ran $target install hook successfully ✓" - cd - - fi - return -} - -# ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ -# ░ ░░░░ ░░░ ░░░ ░░ ░░░ ░ -# ▒ ▒▒ ▒▒ ▒▒▒▒ ▒▒▒▒▒ ▒▒▒▒▒ ▒▒ ▒ -# ▓ ▓▓ ▓▓▓▓ ▓▓▓▓▓ ▓▓▓▓▓ ▓ ▓ ▓ -# █ █ █ ██ █████ █████ ██ █ -# █ ████ ██ ████ ██ ██ ███ █ -# ████████████████████████████████████████ - -# shellcheck disable=1091 -. "${XDG_CONFIG_HOME:-"$HOME/.config"}/clonedev/config" -config_dir=${XDG_CONFIG_HOME:-$HOME/.config}/clonedev - -# shellcheck disable=2015 -mkdir -p "$BASE" && cd "$BASE" || { - warn "Failed to create/cd $BASE ✗" -} - -for target in $TARGETS; do - for repo in $(list "$API_URL/$target/$ENDPOINT" | sed 's|.git$||' | xargs); do - ensure "$repo" - done -done -for repo in $(echo "$EXTRA_REPOS" | xargs); do - ensure "$repo" -done