gitbash 0.2.6 → 0.2.7

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/bin/gitbash CHANGED
@@ -19,6 +19,7 @@ configure_gitbash() {
19
19
  local current_merge="${GITBASH_MERGE_COMMAND:-fork}"
20
20
 
21
21
  echo "Configure gitbash (writes to $CONFIG_FILE)"
22
+ echo
22
23
 
23
24
  local input prefix merge_cmd
24
25
 
@@ -36,7 +37,67 @@ GITBASH_FEATURE_BRANCH_PREFIX="$prefix"
36
37
  GITBASH_MERGE_COMMAND="$merge_cmd"
37
38
  EOF
38
39
 
40
+ echo
39
41
  echo "Saved configuration to $CONFIG_FILE"
42
+
43
+ # Check for shell integration
44
+ check_shell_integration
45
+ }
46
+
47
+ # Check if gitbash shell integration is set up
48
+ check_shell_integration() {
49
+ local shell_rc=""
50
+ local shell_files=("$HOME/.zshrc" "$HOME/.bashrc" "$HOME/.bash_profile")
51
+
52
+ # Find the first existing shell rc file
53
+ for file in "${shell_files[@]}"; do
54
+ if [[ -f "$file" ]]; then
55
+ shell_rc="$file"
56
+ break
57
+ fi
58
+ done
59
+
60
+ if [[ -z "$shell_rc" ]]; then
61
+ echo
62
+ echo "No shell config file found (.zshrc, .bashrc, .bash_profile)"
63
+ return 0
64
+ fi
65
+
66
+ # Check if gitbash integration already exists
67
+ local has_init=false
68
+ local has_alias=false
69
+
70
+ if grep -q 'eval.*gitbash --init' "$shell_rc" 2>/dev/null; then
71
+ has_init=true
72
+ fi
73
+
74
+ if grep -q 'alias.*gitbash' "$shell_rc" 2>/dev/null; then
75
+ has_alias=true
76
+ fi
77
+
78
+ # If neither init nor alias found, offer to add
79
+ if [[ "$has_init" == false && "$has_alias" == false ]]; then
80
+ echo
81
+ echo "Shell integration not found in $shell_rc"
82
+ local add_init
83
+ read -e -p "Add 'eval \"\$(gitbash --init)\"' to $shell_rc? (Y/n): " add_init
84
+ case "$add_init" in
85
+ [nN][oO]|[nN])
86
+ echo "Skipped shell integration."
87
+ ;;
88
+ *)
89
+ echo >> "$shell_rc"
90
+ echo '# gitbash shell integration' >> "$shell_rc"
91
+ echo 'eval "$(gitbash --init)"' >> "$shell_rc"
92
+ echo
93
+ echo "Added to $shell_rc"
94
+ echo "Run 'source $shell_rc' or restart your shell to activate."
95
+ ;;
96
+ esac
97
+ else
98
+ echo
99
+ echo "Shell integration already configured in $shell_rc"
100
+ fi
40
101
  }
41
102
 
42
103
  # Resolve symlinks to get the actual script location
@@ -111,9 +111,6 @@ EOF
111
111
  # -----------------------------
112
112
  # 2. Fetch and prune to sync with remote
113
113
  # -----------------------------
114
- if [[ "$json_mode" == false ]]; then
115
- echo "Fetching and pruning remote..."
116
- fi
117
114
  if ! git fetch --prune origin 2>/dev/null; then
118
115
  if [[ "$json_mode" == false ]]; then
119
116
  echo "⚠ Fetch failed; continuing with local data." >&2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",