gitbash 1.6.0 → 1.6.1

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
@@ -325,8 +325,11 @@ while [[ -L "$SOURCE" ]]; do
325
325
  done
326
326
  SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
327
327
 
328
+ # Export so sourced command files can use it
329
+ export SCRIPT_DIR
330
+
328
331
  COMMANDS_DIR="$SCRIPT_DIR/commands"
329
- VERSION="$(grep -o '"version": *"[^"]*"' "$SCRIPT_DIR/package.json" | cut -d'"' -f4)"
332
+ VERSION="$(grep -o '"version": *"[^"]*"' "$SCRIPT_DIR/package.json" | head -1 | cut -d'"' -f4)"
330
333
 
331
334
  # Available commands
332
335
  COMMANDS=(
@@ -152,19 +152,25 @@ EOF
152
152
  # -----------------------------
153
153
  case "$selection" in
154
154
  "$create_option")
155
- # Find gitbash root directory
156
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
157
- "$GITBASH_ROOT/bin/gitbash" create
155
+ # Use SCRIPT_DIR from parent or compute it
156
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
157
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
158
+ fi
159
+ "$SCRIPT_DIR/bin/gitbash" create
158
160
  ;;
159
161
  "$switch_option")
160
- # Find gitbash root directory
161
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
162
- "$GITBASH_ROOT/bin/gitbash" switch
162
+ # Use SCRIPT_DIR from parent or compute it
163
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
164
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
165
+ fi
166
+ "$SCRIPT_DIR/bin/gitbash" switch
163
167
  ;;
164
168
  "$update_option")
165
- # Find gitbash root directory
166
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
167
- "$GITBASH_ROOT/bin/gitbash" update
169
+ # Use SCRIPT_DIR from parent or compute it
170
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
171
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
172
+ fi
173
+ "$SCRIPT_DIR/bin/gitbash" update
168
174
  ;;
169
175
  "$abort_label")
170
176
  echo "Aborted."
package/commands/pr.sh CHANGED
@@ -93,12 +93,14 @@ EOF
93
93
  echo "Continuing without committing..."
94
94
  ;;
95
95
  *)
96
- # Find gitbash root directory (two levels up from commands/)
97
- SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
98
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
96
+ # Use SCRIPT_DIR from parent or compute it
97
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
98
+ SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)"
99
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
100
+ fi
99
101
 
100
102
  # Run status command for interactive staging and committing
101
- "$GITBASH_ROOT/bin/gitbash" status
103
+ "$SCRIPT_DIR/bin/gitbash" status
102
104
  if [[ $? -ne 0 ]]; then
103
105
  echo "Commit cancelled or failed. Aborting PR creation."
104
106
  return 1
@@ -151,19 +151,25 @@ EOF
151
151
  # -----------------------------
152
152
  case "$selection" in
153
153
  "$stash_option")
154
- # Find gitbash root directory
155
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
156
- "$GITBASH_ROOT/bin/gitbash" stash
154
+ # Use SCRIPT_DIR from parent or compute it
155
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
156
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
157
+ fi
158
+ "$SCRIPT_DIR/bin/gitbash" stash
157
159
  ;;
158
160
  "$unstash_option")
159
- # Find gitbash root directory
160
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
161
- "$GITBASH_ROOT/bin/gitbash" unstash
161
+ # Use SCRIPT_DIR from parent or compute it
162
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
163
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
164
+ fi
165
+ "$SCRIPT_DIR/bin/gitbash" unstash
162
166
  ;;
163
167
  "$cleanup_option")
164
- # Find gitbash root directory
165
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
166
- "$GITBASH_ROOT/bin/gitbash" cleanstash
168
+ # Use SCRIPT_DIR from parent or compute it
169
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
170
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
171
+ fi
172
+ "$SCRIPT_DIR/bin/gitbash" cleanstash
167
173
  ;;
168
174
  "$abort_label")
169
175
  echo "Aborted."
@@ -306,10 +306,12 @@ EOF
306
306
  echo "Ready to commit and push staged changes."
307
307
  echo "Press Ctrl+C to abort."
308
308
  echo
309
- # Find gitbash root directory (two levels up from commands/)
310
- GITBASH_ROOT="$(cd "$SOURCE_DIR/.." && pwd)"
309
+ # Use SCRIPT_DIR from parent or compute it
310
+ if [[ -z "${SCRIPT_DIR:-}" ]]; then
311
+ SCRIPT_DIR="$(cd "$SOURCE_DIR/.." && pwd)"
312
+ fi
311
313
  # Directly prompt for commit message (user can Ctrl+C to abort)
312
- "$GITBASH_ROOT/bin/gitbash" commit -s -p
314
+ "$SCRIPT_DIR/bin/gitbash" commit -s -p
313
315
  break
314
316
  fi
315
317
  done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",