bimagic 1.4.4 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -0
- package/bimagic +64 -12
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -454,6 +454,12 @@ The `Remove files/folders (rm)` option lets you select files and folders interac
|
|
|
454
454
|
|
|
455
455
|
Usage from CLI: `bimagic -a` or `bimagic --architect`
|
|
456
456
|
|
|
457
|
+
### Pull latest changes (Option 6)
|
|
458
|
+
|
|
459
|
+
Fetch all updates from remotes and pull the latest changes from all branches.
|
|
460
|
+
|
|
461
|
+
Usage from CLI: `bimagic -p`
|
|
462
|
+
|
|
457
463
|
### Merge branches (Option 14)
|
|
458
464
|
|
|
459
465
|
Merge another branch into your current branch using an interactive selector. If conflicts occur, you will be notified to resolve them manually.
|
package/bimagic
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
VERSION="v1.4.
|
|
3
|
+
VERSION="v1.4.6"
|
|
4
4
|
|
|
5
5
|
if [[ "$1" == "--version" || "$1" == "-v" ]]; then
|
|
6
6
|
echo "Bimagic Git Wizard $VERSION"
|
|
@@ -53,7 +53,7 @@ BLUE=$(get_ansi_esc "$BIMAGIC_SECONDARY")
|
|
|
53
53
|
PURPLE=$(get_ansi_esc "$BIMAGIC_PRIMARY")
|
|
54
54
|
CYAN=$(get_ansi_esc "$BIMAGIC_INFO")
|
|
55
55
|
GRAY=$(get_ansi_esc "$BIMAGIC_MUTED")
|
|
56
|
-
NC
|
|
56
|
+
NC=$(echo -e "\033[0m") # No Color
|
|
57
57
|
|
|
58
58
|
# Function to draw a progress bar
|
|
59
59
|
draw_progress_bar() {
|
|
@@ -246,15 +246,39 @@ STATUS: $status"
|
|
|
246
246
|
|
|
247
247
|
generate_bar() {
|
|
248
248
|
local percentage=$1
|
|
249
|
-
local
|
|
249
|
+
local width=20
|
|
250
|
+
|
|
250
251
|
# Convert float to integer for bar calculation
|
|
251
252
|
local int_percentage=${percentage%.*}
|
|
252
|
-
|
|
253
|
+
# Safety check for integer conversion
|
|
254
|
+
if [[ ! "$int_percentage" =~ ^[0-9]+$ ]]; then int_percentage=0; fi
|
|
255
|
+
[[ $int_percentage -gt 100 ]] && int_percentage=100
|
|
256
|
+
|
|
257
|
+
local filled=$((int_percentage * width / 100))
|
|
258
|
+
local empty=$((width - filled))
|
|
253
259
|
|
|
254
|
-
|
|
255
|
-
|
|
260
|
+
# Pre-get theme colors for the gradient
|
|
261
|
+
local c1=$(get_ansi_esc "$BANNER_COLOR_1")
|
|
262
|
+
local c2=$(get_ansi_esc "$BANNER_COLOR_2")
|
|
263
|
+
local c3=$(get_ansi_esc "$BANNER_COLOR_3")
|
|
264
|
+
local c4=$(get_ansi_esc "$BANNER_COLOR_4")
|
|
265
|
+
local c5=$(get_ansi_esc "$BANNER_COLOR_5")
|
|
266
|
+
local colors=("$c1" "$c2" "$c3" "$c4" "$c5")
|
|
267
|
+
local gray=$(get_ansi_esc "$BIMAGIC_MUTED")
|
|
268
|
+
|
|
269
|
+
local bar="${gray}[${NC}"
|
|
270
|
+
for ((i = 0; i < filled; i++)); do
|
|
271
|
+
local color_idx=$(( i * 5 / width ))
|
|
272
|
+
bar+="${colors[$color_idx]}█"
|
|
273
|
+
done
|
|
274
|
+
|
|
275
|
+
bar+="$gray"
|
|
276
|
+
for ((i = 0; i < empty; i++)); do
|
|
277
|
+
bar+="░"
|
|
256
278
|
done
|
|
257
|
-
|
|
279
|
+
bar+="]${NC}"
|
|
280
|
+
|
|
281
|
+
echo -e "$bar"
|
|
258
282
|
}
|
|
259
283
|
|
|
260
284
|
# Function to get contributor statistics
|
|
@@ -363,10 +387,11 @@ show_contributor_stats() {
|
|
|
363
387
|
# Clean up author name
|
|
364
388
|
author=$(echo "$author" | sed 's/^ *//;s/ *$//')
|
|
365
389
|
|
|
366
|
-
# Generate bar
|
|
390
|
+
# Generate themed bar
|
|
367
391
|
local bar=$(generate_bar "$percentage")
|
|
368
392
|
|
|
369
|
-
|
|
393
|
+
# Display entry with theme colors
|
|
394
|
+
printf "${BLUE}%-15s${NC} %s ${YELLOW}%5.1f%%${NC} (${CYAN}%d lines${NC})\n" \
|
|
370
395
|
"$author" "$bar" "$percentage" "$lines"
|
|
371
396
|
|
|
372
397
|
# Track most active (most commits)
|
|
@@ -389,14 +414,14 @@ show_contributor_stats() {
|
|
|
389
414
|
echo
|
|
390
415
|
echo -e "${CYAN}Highlights:${NC}"
|
|
391
416
|
if [[ -n "$most_active_author" ]]; then
|
|
392
|
-
echo -e "${BLUE}Most Active:${NC} $most_active_author ($most_commits commits)"
|
|
417
|
+
echo -e "${BLUE}Most Active:${NC} ${PURPLE}$most_active_author${NC} (${YELLOW}$most_commits commits${NC})"
|
|
393
418
|
fi
|
|
394
419
|
if [[ -n "$most_productive_author" ]]; then
|
|
395
|
-
echo -e "${BLUE}Most Productive:${NC} $most_productive_author ($highest_avg lines/commit)"
|
|
420
|
+
echo -e "${BLUE}Most Productive:${NC} ${PURPLE}$most_productive_author${NC} (${YELLOW}$highest_avg lines/commit${NC})"
|
|
396
421
|
fi
|
|
397
422
|
|
|
398
423
|
local total_contributors=$(echo "$stats" | wc -l)
|
|
399
|
-
echo -e "${BLUE}Total Contributors:${NC} $total_contributors"
|
|
424
|
+
echo -e "${BLUE}Total Contributors:${NC} ${YELLOW}$total_contributors${NC}"
|
|
400
425
|
}
|
|
401
426
|
|
|
402
427
|
# Function to clone a repository (Standard or Interactive)
|
|
@@ -688,6 +713,10 @@ while [[ $# -gt 0 ]]; do
|
|
|
688
713
|
CLI_MODE="graph"
|
|
689
714
|
shift
|
|
690
715
|
;;
|
|
716
|
+
-p)
|
|
717
|
+
CLI_MODE="pull"
|
|
718
|
+
shift
|
|
719
|
+
;;
|
|
691
720
|
-a | --architect)
|
|
692
721
|
CLI_MODE="architect"
|
|
693
722
|
shift
|
|
@@ -721,6 +750,29 @@ if [[ "$CLI_MODE" == "status" ]]; then
|
|
|
721
750
|
exit 0
|
|
722
751
|
fi
|
|
723
752
|
|
|
753
|
+
if [[ "$CLI_MODE" == "pull" ]]; then
|
|
754
|
+
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
755
|
+
print_error "Not a git repository!"
|
|
756
|
+
exit 1
|
|
757
|
+
fi
|
|
758
|
+
|
|
759
|
+
# 1. Fetch
|
|
760
|
+
if gum spin --title "Fetching updates..." -- git fetch --all; then
|
|
761
|
+
print_status "Fetch complete."
|
|
762
|
+
else
|
|
763
|
+
print_warning "Fetch encountered issues during fetch."
|
|
764
|
+
fi
|
|
765
|
+
|
|
766
|
+
# 2. Pull
|
|
767
|
+
if gum spin --title "Pulling all..." -- git pull --all; then
|
|
768
|
+
print_status "Pull all complete."
|
|
769
|
+
else
|
|
770
|
+
print_error "Pull failed. There might be conflicts or no upstream set."
|
|
771
|
+
exit 1
|
|
772
|
+
fi
|
|
773
|
+
exit 0
|
|
774
|
+
fi
|
|
775
|
+
|
|
724
776
|
if [[ "$CLI_MODE" == "graph" ]]; then
|
|
725
777
|
if ! git rev-parse --git-dir >/dev/null 2>&1; then
|
|
726
778
|
print_error "Not a git repository!"
|