bimagic 1.4.3 → 1.4.4
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 +9 -2
- package/bimagic +79 -9
- package/package.json +35 -35
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ Bimagic is an interactive command-line tool that streamlines common Git operatio
|
|
|
26
26
|
- 🔐 Secure GitHub authentication via personal access tokens
|
|
27
27
|
- 📦 Easy repository initialization and setup
|
|
28
28
|
- 📥 Clone repositories (Standard or Interactive selection)
|
|
29
|
+
- 📊 Dynamic themed progress bar for cloning
|
|
30
|
+
- 🗜️ Shallow clone support (--depth)
|
|
29
31
|
- 🔄 Simplified push/pull operations
|
|
30
32
|
- 🌿 Branch management made easy
|
|
31
33
|
- 📊 Status dashboard (ahead/behind, branch, clean/uncommitted/conflicts)
|
|
@@ -309,6 +311,10 @@ You can also use flags to perform specific actions immediately:
|
|
|
309
311
|
```bash
|
|
310
312
|
bimagic -d "repo-url"
|
|
311
313
|
```
|
|
314
|
+
- **Shallow Clone**:
|
|
315
|
+
```bash
|
|
316
|
+
bimagic -d "repo-url" --depth 1
|
|
317
|
+
```
|
|
312
318
|
- **Interactive Clone** (Select specific files/folders to download):
|
|
313
319
|
```bash
|
|
314
320
|
bimagic -d -i "repo-url"
|
|
@@ -367,11 +373,12 @@ At the top of the interface, a status box summarizes:
|
|
|
367
373
|
|
|
368
374
|
### Clone repository (Option 1)
|
|
369
375
|
|
|
370
|
-
This feature allows you to clone a repository with two modes:
|
|
376
|
+
This feature allows you to clone a repository with two modes, both featuring a **themed progress bar** to show real-time download status:
|
|
371
377
|
|
|
372
378
|
#### Standard Clone
|
|
373
379
|
|
|
374
|
-
Perform a full `git clone` of the target repository.
|
|
380
|
+
Perform a full or shallow `git clone` of the target repository.
|
|
381
|
+
- Usage from CLI: `bimagic -d "repo-url" [--depth <number>]`
|
|
375
382
|
|
|
376
383
|
#### Interactive Clone (Sparse Checkout)
|
|
377
384
|
|
package/bimagic
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
|
|
3
|
-
VERSION="v1.4.
|
|
3
|
+
VERSION="v1.4.4"
|
|
4
4
|
|
|
5
5
|
if [[ "$1" == "--version" || "$1" == "-v" ]]; then
|
|
6
6
|
echo "Bimagic Git Wizard $VERSION"
|
|
@@ -52,8 +52,25 @@ YELLOW=$(get_ansi_esc "$BIMAGIC_WARNING")
|
|
|
52
52
|
BLUE=$(get_ansi_esc "$BIMAGIC_SECONDARY")
|
|
53
53
|
PURPLE=$(get_ansi_esc "$BIMAGIC_PRIMARY")
|
|
54
54
|
CYAN=$(get_ansi_esc "$BIMAGIC_INFO")
|
|
55
|
+
GRAY=$(get_ansi_esc "$BIMAGIC_MUTED")
|
|
55
56
|
NC='\033[0m' # No Color
|
|
56
57
|
|
|
58
|
+
# Function to draw a progress bar
|
|
59
|
+
draw_progress_bar() {
|
|
60
|
+
local label=$1
|
|
61
|
+
local percent=$2
|
|
62
|
+
local width=30
|
|
63
|
+
local filled=$((percent * width / 100))
|
|
64
|
+
local empty=$((width - filled))
|
|
65
|
+
|
|
66
|
+
local bar=""
|
|
67
|
+
for ((i = 0; i < filled; i++)); do bar+="█"; done
|
|
68
|
+
local bg=""
|
|
69
|
+
for ((i = 0; i < empty; i++)); do bg+="░"; done
|
|
70
|
+
|
|
71
|
+
printf "\r\e[K${CYAN}%-20s${NC} [${PURPLE}%s${NC}${GRAY}%s${NC}] ${YELLOW}%3d%%${NC}" "$label" "$bar" "$bg" "$percent"
|
|
72
|
+
}
|
|
73
|
+
|
|
57
74
|
# Ensure gum is installed
|
|
58
75
|
if ! command -v gum &>/dev/null; then
|
|
59
76
|
echo "Error: gum is not installed."
|
|
@@ -386,6 +403,7 @@ show_contributor_stats() {
|
|
|
386
403
|
clone_repo() {
|
|
387
404
|
local url=$1
|
|
388
405
|
local interactive=$2
|
|
406
|
+
local depth=$3
|
|
389
407
|
|
|
390
408
|
# Extract repo name from URL (basename, remove .git)
|
|
391
409
|
local repo_name=$(basename "$url" .git)
|
|
@@ -395,11 +413,30 @@ clone_repo() {
|
|
|
395
413
|
return 1
|
|
396
414
|
fi
|
|
397
415
|
|
|
416
|
+
local depth_arg=""
|
|
417
|
+
if [[ -n "$depth" ]]; then
|
|
418
|
+
depth_arg="--depth $depth"
|
|
419
|
+
fi
|
|
420
|
+
|
|
398
421
|
if [[ "$interactive" == "true" ]]; then
|
|
399
422
|
print_status "Initializing interactive clone for $repo_name..."
|
|
400
423
|
|
|
401
424
|
# 1. Clone with --no-checkout and --filter=blob:none (downloads commits/trees, no file contents)
|
|
402
|
-
|
|
425
|
+
print_status "Cloning structure for $repo_name..."
|
|
426
|
+
(
|
|
427
|
+
set -o pipefail
|
|
428
|
+
git clone --progress --filter=blob:none --no-checkout $depth_arg "$url" "$repo_name" 2>&1 | while read -r -d $'\r' line; do
|
|
429
|
+
if [[ $line =~ Receiving\ objects:\ +([0-9]+)% ]]; then
|
|
430
|
+
draw_progress_bar "Receiving Structure" "${BASH_REMATCH[1]}"
|
|
431
|
+
elif [[ $line =~ Resolving\ deltas:\ +([0-9]+)% ]]; then
|
|
432
|
+
draw_progress_bar "Resolving Deltas" "${BASH_REMATCH[1]}"
|
|
433
|
+
fi
|
|
434
|
+
done
|
|
435
|
+
)
|
|
436
|
+
local status=$?
|
|
437
|
+
echo ""
|
|
438
|
+
|
|
439
|
+
if [[ $status -ne 0 || ! -d "$repo_name" ]]; then
|
|
403
440
|
print_error "Clone failed."
|
|
404
441
|
return 1
|
|
405
442
|
fi
|
|
@@ -432,14 +469,39 @@ clone_repo() {
|
|
|
432
469
|
# If the list is huge, this might fail on command line length.
|
|
433
470
|
# Ideally we pipe to 'git sparse-checkout set --stdin', but gum returns newline separated.
|
|
434
471
|
|
|
435
|
-
|
|
472
|
+
print_status "Downloading selected files..."
|
|
473
|
+
(
|
|
474
|
+
set -o pipefail
|
|
475
|
+
git checkout --progress HEAD 2>&1 | while read -r -d $'\r' line; do
|
|
476
|
+
if [[ $line =~ Updating\ files:\ +([0-9]+)% ]]; then
|
|
477
|
+
draw_progress_bar "Updating Files" "${BASH_REMATCH[1]}"
|
|
478
|
+
fi
|
|
479
|
+
done
|
|
480
|
+
)
|
|
481
|
+
echo ""
|
|
436
482
|
|
|
437
483
|
popd >/dev/null
|
|
438
484
|
print_status "Successfully cloned selected files into '$repo_name'!"
|
|
439
485
|
|
|
440
486
|
else
|
|
441
|
-
# Standard clone
|
|
442
|
-
|
|
487
|
+
# Standard clone with progress bar
|
|
488
|
+
print_status "Cloning $url into $repo_name..."
|
|
489
|
+
|
|
490
|
+
# Use a subshell with pipefail to catch git clone errors
|
|
491
|
+
(
|
|
492
|
+
set -o pipefail
|
|
493
|
+
git clone --progress $depth_arg "$url" "$repo_name" 2>&1 | while read -r -d $'\r' line; do
|
|
494
|
+
if [[ $line =~ Receiving\ objects:\ +([0-9]+)% ]]; then
|
|
495
|
+
draw_progress_bar "Receiving Objects" "${BASH_REMATCH[1]}"
|
|
496
|
+
elif [[ $line =~ Resolving\ deltas:\ +([0-9]+)% ]]; then
|
|
497
|
+
draw_progress_bar "Resolving Deltas" "${BASH_REMATCH[1]}"
|
|
498
|
+
fi
|
|
499
|
+
done
|
|
500
|
+
)
|
|
501
|
+
local status=$?
|
|
502
|
+
echo "" # New line after progress bar
|
|
503
|
+
|
|
504
|
+
if [[ $status -eq 0 && -d "$repo_name" ]]; then
|
|
443
505
|
print_status "Successfully cloned '$url' into '$repo_name'!"
|
|
444
506
|
else
|
|
445
507
|
print_error "Clone failed."
|
|
@@ -593,6 +655,7 @@ CLI_MODE=""
|
|
|
593
655
|
CLI_URL=""
|
|
594
656
|
CLI_MSG=""
|
|
595
657
|
CLI_INTERACTIVE="false"
|
|
658
|
+
CLI_DEPTH=""
|
|
596
659
|
|
|
597
660
|
# Preserve args in a loop
|
|
598
661
|
while [[ $# -gt 0 ]]; do
|
|
@@ -601,6 +664,10 @@ while [[ $# -gt 0 ]]; do
|
|
|
601
664
|
CLI_MODE="clone"
|
|
602
665
|
shift
|
|
603
666
|
;;
|
|
667
|
+
--depth)
|
|
668
|
+
CLI_DEPTH="$2"
|
|
669
|
+
shift 2
|
|
670
|
+
;;
|
|
604
671
|
-i)
|
|
605
672
|
CLI_INTERACTIVE="true"
|
|
606
673
|
shift
|
|
@@ -644,10 +711,11 @@ if [[ "$CLI_MODE" == "clone" ]]; then
|
|
|
644
711
|
print_error "Error: Repository URL required with -d"
|
|
645
712
|
exit 1
|
|
646
713
|
fi
|
|
647
|
-
clone_repo "$CLI_URL" "$CLI_INTERACTIVE"
|
|
648
|
-
exit
|
|
714
|
+
clone_repo "$CLI_URL" "$CLI_INTERACTIVE" "$CLI_DEPTH"
|
|
715
|
+
exit 0
|
|
649
716
|
fi
|
|
650
717
|
|
|
718
|
+
|
|
651
719
|
if [[ "$CLI_MODE" == "status" ]]; then
|
|
652
720
|
show_repo_status
|
|
653
721
|
exit 0
|
|
@@ -849,12 +917,14 @@ while true; do
|
|
|
849
917
|
repo_url=$(gum input --placeholder "Enter repository URL")
|
|
850
918
|
if [[ -z "$repo_url" ]]; then continue; fi
|
|
851
919
|
|
|
920
|
+
repo_depth=$(gum input --placeholder "Enter depth (empty for full clone)")
|
|
921
|
+
|
|
852
922
|
clone_mode=$(gum choose "Standard Clone" "Interactive (Select files)")
|
|
853
923
|
|
|
854
924
|
if [[ "$clone_mode" == "Interactive (Select files)" ]]; then
|
|
855
|
-
clone_repo "$repo_url" "true"
|
|
925
|
+
clone_repo "$repo_url" "true" "$repo_depth"
|
|
856
926
|
else
|
|
857
|
-
clone_repo "$repo_url" "false"
|
|
927
|
+
clone_repo "$repo_url" "false" "$repo_depth"
|
|
858
928
|
fi
|
|
859
929
|
;;
|
|
860
930
|
" Stash operations")
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
"name": "bimagic",
|
|
3
|
+
"version": "1.4.4",
|
|
4
|
+
"description": "A powerful Bash-based Git automation tool that simplifies your GitHub workflow.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"bimagic": "./bimagic",
|
|
7
|
+
"wz": "./bimagic"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"No tests specified\""
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/orion-kernel/bimagic.git"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"git",
|
|
18
|
+
"cli",
|
|
19
|
+
"automation",
|
|
20
|
+
"bash",
|
|
21
|
+
"tui",
|
|
22
|
+
"gum"
|
|
23
|
+
],
|
|
24
|
+
"author": "Bimbok",
|
|
25
|
+
"contributors": [
|
|
26
|
+
"Bimbok",
|
|
27
|
+
"Aditya Paul (adityapaul26)"
|
|
28
|
+
],
|
|
29
|
+
"license": "MIT",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/orion-kernel/bimagic/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/orion-kernel/bimagic#readme",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"bimagic": "^1.4.4"
|
|
36
|
+
}
|
|
37
37
|
}
|