gitbash 1.3.0 → 1.3.2

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.
Files changed (2) hide show
  1. package/commands/create.sh +39 -28
  2. package/package.json +1 -1
@@ -163,49 +163,60 @@ TYPES
163
163
 
164
164
  if [[ ${#positional_args[@]} -gt 0 ]]; then
165
165
  # Arguments provided - use one-liner mode
166
- jira_link="${positional_args[0]}"
167
- # Join remaining arguments as title
168
- if [[ ${#positional_args[@]} -gt 1 ]]; then
169
- branch_title="${positional_args[*]:1}"
166
+ # Use array index 1 for zsh compatibility (zsh arrays are 1-indexed, bash uses 0)
167
+ if [[ -n "${ZSH_VERSION:-}" ]]; then
168
+ jira_link="${positional_args[1]}"
169
+ if [[ ${#positional_args[@]} -gt 1 ]]; then
170
+ branch_title="${positional_args[*]:1}"
171
+ else
172
+ branch_title=""
173
+ fi
170
174
  else
171
- branch_title=""
175
+ jira_link="${positional_args[0]}"
176
+ if [[ ${#positional_args[@]} -gt 1 ]]; then
177
+ branch_title="${positional_args[*]:1}"
178
+ else
179
+ branch_title=""
180
+ fi
172
181
  fi
173
182
  else
174
183
  # Interactive mode
175
- echo "Enter Jira link (e.g., https://jira.company.com/browse/PROJ-123):"
184
+ echo "Enter Jira link (e.g., https://jira.company.com/browse/PROJ-123) or press Enter to skip:"
176
185
  prompt_read " > " jira_link
177
186
  fi
178
187
 
179
- if [[ -z "$jira_link" ]]; then
180
- echo "Error: No Jira link provided."
181
- return 1
182
- fi
183
-
184
188
  # -----------------------------
185
189
  # 2. Parse issue number from Jira link
186
190
  # -----------------------------
187
191
  local issue_number
188
- # First try to match just the issue number pattern (e.g., PROJ-123)
189
- issue_number=$(echo "$jira_link" | grep -o -E '^[A-Z]+-[0-9]+$' | head -1)
190
192
 
191
- # If not a direct match, try to extract from URL
192
- if [[ -z "$issue_number" ]]; then
193
- # Match patterns like PROJ-123, ABC-456, etc.
194
- # Supports both /browse/PROJ-123 and selectedIssue=PROJ-123 formats
195
- issue_number=$(echo "$jira_link" | grep -o -E '(browse/|selectedIssue=)[A-Z]+-[0-9]+' | grep -o '[A-Z]\+-[0-9]\+' | head -1)
196
- fi
197
-
198
- if [[ -z "$issue_number" ]]; then
199
- echo "Warning: Could not parse issue number from Jira link. Using NOISSUE."
193
+ if [[ -z "$jira_link" ]]; then
194
+ # No Jira link provided, use NOISSUE
200
195
  issue_number="NOISSUE"
201
- # If parsing failed and we had arguments, include the first arg in the title
202
- if [[ -n "$branch_title" ]]; then
203
- branch_title="$jira_link $branch_title"
196
+ print_info "No Jira link provided. Using NOISSUE."
197
+ else
198
+ # First try to match just the issue number pattern (e.g., PROJ-123)
199
+ issue_number=$(echo "$jira_link" | grep -o -E '^[A-Z]+-[0-9]+$' | head -1)
200
+
201
+ # If not a direct match, try to extract from URL
202
+ if [[ -z "$issue_number" ]]; then
203
+ # Match patterns like PROJ-123, ABC-456, etc.
204
+ # Supports both /browse/PROJ-123 and selectedIssue=PROJ-123 formats
205
+ issue_number=$(echo "$jira_link" | grep -o -E '(browse/|selectedIssue=)[A-Z]+-[0-9]+' | grep -o '[A-Z]\+-[0-9]\+' | head -1)
206
+ fi
207
+
208
+ if [[ -z "$issue_number" ]]; then
209
+ print_warning "Could not parse issue number from Jira link. Using NOISSUE."
210
+ issue_number="NOISSUE"
211
+ # If parsing failed and we had arguments, include the first arg in the title
212
+ if [[ -n "$branch_title" ]]; then
213
+ branch_title="$jira_link $branch_title"
214
+ else
215
+ branch_title="$jira_link"
216
+ fi
204
217
  else
205
- branch_title="$jira_link"
218
+ echo "Parsed issue number: $issue_number"
206
219
  fi
207
- else
208
- echo "Parsed issue number: $issue_number"
209
220
  fi
210
221
  echo
211
222
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitbash",
3
- "version": "1.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Opinionated git utilities for bash with fzf-powered menus",
5
5
  "author": "jaggli",
6
6
  "license": "MIT",