gitbash 0.2.2 → 0.2.3

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.
@@ -147,15 +147,15 @@ EOF
147
147
  # 3. Run fzf menu
148
148
  # -----------------------------
149
149
  local selection
150
- selection=$(printf "%s\n" "$choices" \
151
- | fzf --prompt="Branch action > " \
150
+ selection=$(fzf --prompt="Branch action > " \
152
151
  -i \
153
152
  --reverse \
154
153
  --border \
155
154
  --header="What would you like to do?" \
156
155
  --no-multi \
157
- --bind=enter:accept
158
- ) || true
156
+ --bind=enter:accept \
157
+ <<< "$choices"
158
+ ) </dev/tty || true
159
159
 
160
160
  # ESC or Ctrl-C
161
161
  if [[ -z "$selection" ]]; then
@@ -108,8 +108,7 @@ EOF
108
108
  # 3. Run fzf full-screen picker with preview (multi-select)
109
109
  # -----------------------------
110
110
  local selection
111
- selection=$(printf "%s\n" "$choices" \
112
- | fzf --prompt="Available stashes > " \
111
+ selection=$(fzf --prompt="Available stashes > " \
113
112
  -i \
114
113
  --reverse \
115
114
  --border \
@@ -123,8 +122,9 @@ EOF
123
122
  else
124
123
  echo "No preview";
125
124
  fi
126
- '
127
- ) || true
125
+ ' \
126
+ <<< "$choices"
127
+ ) </dev/tty || true
128
128
 
129
129
  # ESC or Ctrl-C
130
130
  if [[ -z "$selection" ]]; then
@@ -141,7 +141,7 @@ EOF
141
141
 
142
142
  # Get list of remote branches (without origin/ prefix)
143
143
  local remote_branches
144
- remote_branches=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin | sed 's|^origin/||' | grep -v '^HEAD$')
144
+ remote_branches=$(git for-each-ref --format='%(refname:short)' refs/remotes/origin | sed 's|^origin/||' | grep -v '^HEAD$' || true)
145
145
 
146
146
  # Arrays to hold branches by category (format: timestamp|branch|relative_date|author_email|author_name)
147
147
  local merged_branches=()
@@ -327,7 +327,7 @@ EOF
327
327
  toggle_sequence+="+first"
328
328
 
329
329
  local selection
330
- selection=$(cat "$branch_file" | fzf \
330
+ selection=$(fzf \
331
331
  --prompt="Local branches to clean up > " \
332
332
  -i \
333
333
  --reverse \
@@ -351,8 +351,9 @@ Found $total_count branches ($preselect_count pre-selected for deletion)" \
351
351
  fi
352
352
  ' \
353
353
  --preview-window=right:35% \
354
- --bind "load:$toggle_sequence"
355
- ) || true
354
+ --bind "load:$toggle_sequence" \
355
+ < "$branch_file"
356
+ ) </dev/tty || true
356
357
 
357
358
  # Cleanup temp files
358
359
  rm -f "$branch_file" "$preselect_file"
@@ -111,7 +111,7 @@ EOF
111
111
  # 4. Run fzf picker
112
112
  # -----------------------------
113
113
  local selection
114
- selection=$(cat "$commit_file" | fzf \
114
+ selection=$(fzf \
115
115
  --prompt="Commits on '$current_branch' > " \
116
116
  -i \
117
117
  --reverse \
@@ -137,8 +137,9 @@ Showing last $count commits" \
137
137
  git show --color=always "$hash" 2>/dev/null | head -100;
138
138
  fi
139
139
  ' \
140
- --preview-window=right:50%
141
- ) || true
140
+ --preview-window=right:50% \
141
+ < "$commit_file"
142
+ ) </dev/tty || true
142
143
 
143
144
  # Cleanup temp file
144
145
  rm -f "$commit_file"
package/commands/stale.sh CHANGED
@@ -172,7 +172,7 @@ EOF
172
172
  fi
173
173
  # Format: display branch (padded), date, author, TAB, full branch name
174
174
  printf "%-${max_branch_length}s %-20s %-25s\t%s\n" "$display_branch" "$date" "$author" "$full_branch"
175
- done)
175
+ done || true)
176
176
 
177
177
  # Build stale branch list (only branches older than 3 months)
178
178
  local stale_branch_list
@@ -192,7 +192,7 @@ EOF
192
192
  # Format: display branch (padded), date, author, TAB, full branch name
193
193
  printf "%-${max_branch_length}s %-20s %-25s\t%s\n" "$display_branch" "$date" "$author" "$full_branch"
194
194
  fi
195
- done)
195
+ done || true)
196
196
 
197
197
  if [[ -z "$all_branch_list" ]]; then
198
198
  if [[ "$json_mode" == true ]]; then
@@ -246,7 +246,7 @@ EOF
246
246
 
247
247
  json_output+="{\"last_change_timestamp\":$timestamp,\"author_email\":\"$author_email\",\"author_name\":\"$author_name\",\"name\":\"$name\",\"last_change_relative\":\"$rel_date\"}"
248
248
  fi
249
- done < <(git for-each-ref --sort=committerdate --format='%(refname:short)|%(committerdate:relative)|%(authorname)|%(authoremail)|%(committerdate:unix)' refs/remotes/origin 2>/dev/null | grep -v 'origin/HEAD' | grep -v '^origin$')
249
+ done < <(git for-each-ref --sort=committerdate --format='%(refname:short)|%(committerdate:relative)|%(authorname)|%(authoremail)|%(committerdate:unix)' refs/remotes/origin 2>/dev/null | grep -v 'origin/HEAD' | grep -v '^origin$' || true)
250
250
  } &>/dev/null
251
251
  json_output+="]"
252
252
  echo "$json_output"
@@ -314,7 +314,7 @@ HEADER_EOF
314
314
 
315
315
  local selection
316
316
  selection=$(
317
- cat "$stale_file" | fzf \
317
+ fzf \
318
318
  --prompt="Stale branches (>3 months, oldest first) > " \
319
319
  --query="$filter" \
320
320
  -i \
@@ -340,8 +340,9 @@ Showing $stale_count stale branches (older than 3 months)" \
340
340
  git log --oneline --color=always -n 15 "origin/$branch" 2>/dev/null || echo "No commits found";
341
341
  fi
342
342
  ' \
343
- --preview-window=right:35%
344
- ) || true
343
+ --preview-window=right:35% \
344
+ < "$stale_file"
345
+ ) </dev/tty || true
345
346
 
346
347
  # Cleanup temp files
347
348
  rm -f "$stale_file" "$all_file" "$state_file" "$toggle_script" "$prompt_script" "$header_script"
@@ -168,7 +168,7 @@ EOF
168
168
  fi
169
169
  # Format: display branch (padded), date, author, TAB, full branch name
170
170
  printf "%-${max_branch_length}s %-20s %-25s\t%s\n" "$display_branch" "$date" "$author" "$full_branch"
171
- done)
171
+ done || true)
172
172
 
173
173
  # Build stale branch list (only branches older than 3 months)
174
174
  local stale_branch_list
@@ -188,7 +188,7 @@ EOF
188
188
  # Format: display branch (padded), date, author, TAB, full branch name
189
189
  printf "%-${max_branch_length}s %-20s %-25s\t%s\n" "$display_branch" "$date" "$author" "$full_branch"
190
190
  fi
191
- done)
191
+ done || true)
192
192
 
193
193
  if [[ -z "$all_branch_list" ]]; then
194
194
  if [[ "$json_mode" == true ]]; then
@@ -242,7 +242,7 @@ EOF
242
242
 
243
243
  json_output+="{\"last_change_timestamp\":$timestamp,\"author_email\":\"$author_email\",\"author_name\":\"$author_name\",\"name\":\"$name\",\"last_change_relative\":\"$rel_date\"}"
244
244
  fi
245
- done < <(git for-each-ref --sort=committerdate --format='%(refname:short)|%(committerdate:relative)|%(authorname)|%(authoremail)|%(committerdate:unix)' refs/remotes/origin 2>/dev/null | grep -v 'origin/HEAD' | grep -v '^origin$')
245
+ done < <(git for-each-ref --sort=committerdate --format='%(refname:short)|%(committerdate:relative)|%(authorname)|%(authoremail)|%(committerdate:unix)' refs/remotes/origin 2>/dev/null | grep -v 'origin/HEAD' | grep -v '^origin$' || true)
246
246
  } &>/dev/null
247
247
  json_output+="]"
248
248
  echo "$json_output"
@@ -310,7 +310,7 @@ HEADER_EOF
310
310
 
311
311
  local selection
312
312
  selection=$(
313
- cat "$stale_file" | fzf \
313
+ fzf \
314
314
  --prompt="Stale branches (>3 months, oldest first) > " \
315
315
  --query="$filter" \
316
316
  -i \
@@ -336,8 +336,9 @@ Showing $stale_count stale branches (older than 3 months)" \
336
336
  git log --oneline --color=always -n 15 "origin/$branch" 2>/dev/null || echo "No commits found";
337
337
  fi
338
338
  ' \
339
- --preview-window=right:35%
340
- )
339
+ --preview-window=right:35% \
340
+ < "$stale_file"
341
+ ) </dev/tty || true
341
342
 
342
343
  # Cleanup temp files
343
344
  rm -f "$stale_file" "$all_file" "$state_file" "$toggle_script" "$prompt_script" "$header_script"
@@ -146,15 +146,15 @@ EOF
146
146
  # 3. Run fzf menu
147
147
  # -----------------------------
148
148
  local selection
149
- selection=$(printf "%s\n" "$choices" \
150
- | fzf --prompt="Stash action > " \
149
+ selection=$(fzf --prompt="Stash action > " \
151
150
  -i \
152
151
  --reverse \
153
152
  --border \
154
153
  --header="What would you like to do?" \
155
154
  --no-multi \
156
- --bind=enter:accept
157
- ) || true
155
+ --bind=enter:accept \
156
+ <<< "$choices"
157
+ ) </dev/tty || true
158
158
 
159
159
  # ESC or Ctrl-C
160
160
  if [[ -z "$selection" ]]; then
@@ -129,7 +129,7 @@ EOF
129
129
  while true; do
130
130
  local selected_output
131
131
  selected_output=$(
132
- echo "$status_output" | fzf \
132
+ fzf \
133
133
  --height=100% \
134
134
  -i \
135
135
  --reverse \
@@ -167,8 +167,9 @@ EOF
167
167
  git diff --color=always "$file" 2>/dev/null | delta 2>/dev/null || git diff --color=always "$file" 2>/dev/null;
168
168
  fi
169
169
  ' \
170
- --preview-window=right:60%
171
- ) || true
170
+ --preview-window=right:60% \
171
+ <<< "$status_output"
172
+ ) </dev/tty || true
172
173
 
173
174
  # Parse the key pressed and the selected files
174
175
  local key_pressed
@@ -105,10 +105,11 @@ EOF
105
105
  if ! echo "$local_branches" | grep -qx "$local_name"; then
106
106
  echo "$remote"
107
107
  fi
108
- done)
108
+ done || true)
109
109
 
110
110
  local selected_branch
111
- selected_branch=$(
111
+ local branch_list
112
+ branch_list=$(
112
113
  {
113
114
  # List local branches
114
115
  echo "$local_branches" | sed 's/^/local: /'
@@ -118,7 +119,10 @@ EOF
118
119
  # List filtered remote branches
119
120
  echo "$remote_branches" | sed 's/^/remote: /'
120
121
  fi
121
- } | fzf \
122
+ }
123
+ )
124
+ selected_branch=$(
125
+ fzf \
122
126
  --height=40% \
123
127
  --reverse \
124
128
  --border \
@@ -127,8 +131,9 @@ EOF
127
131
  -i \
128
132
  --preview="branch=\$(echo {} | sed 's/^[^:]*: //'); if [[ \"\$branch\" == *───* ]]; then echo 'Spacer - not selectable'; else git log --color=always -n 1 --format='%C(bold cyan)Author:%C(reset) %an%n%C(bold cyan)Date:%C(reset) %ar (%ad)%n%C(bold cyan)Message:%C(reset) %s%n' --date=format:'%Y-%m-%d %H:%M' \"\$branch\" 2>/dev/null && echo && git log --oneline --color=always -n 10 \"\$branch\" 2>/dev/null; fi" \
129
133
  --preview-window=right:50% \
130
- --header="Current: $current_branch"
131
- ) || true
134
+ --header="Current: $current_branch" \
135
+ <<< "$branch_list"
136
+ ) </dev/tty || true
132
137
 
133
138
  # -----------------------------
134
139
  # 4. Handle selection
@@ -111,8 +111,7 @@ EOF
111
111
  # 3. Run fzf full-screen picker with preview
112
112
  # -----------------------------
113
113
  local selection
114
- selection=$(printf "%s\n" "$choices" \
115
- | fzf --prompt="Available stashes > " \
114
+ selection=$(fzf --prompt="Available stashes > " \
116
115
  -i \
117
116
  --reverse \
118
117
  --border \
@@ -126,8 +125,9 @@ EOF
126
125
  else
127
126
  echo "No preview";
128
127
  fi
129
- '
130
- ) || true
128
+ ' \
129
+ <<< "$choices"
130
+ ) </dev/tty || true
131
131
 
132
132
  # ESC or Ctrl-C
133
133
  if [[ -z "$selection" ]]; then
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",