gitbash 1.2.0 → 1.3.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/commands/_utils.sh +14 -12
- package/commands/commit.sh +2 -6
- package/commands/create.sh +25 -23
- package/package.json +1 -1
package/commands/_utils.sh
CHANGED
|
@@ -109,37 +109,39 @@ require_git_repo() {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
# Get delta arguments based on theme setting
|
|
112
|
-
# Uses GITBASH_THEME:
|
|
112
|
+
# Uses GITBASH_THEME: light (default), dark, or auto
|
|
113
113
|
_get_delta_args() {
|
|
114
|
-
local theme="${GITBASH_THEME:-
|
|
114
|
+
local theme="${GITBASH_THEME:-light}"
|
|
115
115
|
case "$theme" in
|
|
116
|
-
light)
|
|
117
|
-
echo "--light"
|
|
118
|
-
;;
|
|
119
116
|
dark)
|
|
120
117
|
echo "--dark"
|
|
121
118
|
;;
|
|
122
|
-
|
|
123
|
-
# auto - let delta detect
|
|
119
|
+
auto)
|
|
120
|
+
# auto - let delta detect
|
|
124
121
|
echo ""
|
|
125
122
|
;;
|
|
123
|
+
*)
|
|
124
|
+
# light is default
|
|
125
|
+
echo "--light"
|
|
126
|
+
;;
|
|
126
127
|
esac
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
# Get bat arguments based on theme setting
|
|
130
131
|
_get_bat_args() {
|
|
131
|
-
local theme="${GITBASH_THEME:-
|
|
132
|
+
local theme="${GITBASH_THEME:-light}"
|
|
132
133
|
case "$theme" in
|
|
133
|
-
light)
|
|
134
|
-
echo "--theme=GitHub"
|
|
135
|
-
;;
|
|
136
134
|
dark)
|
|
137
135
|
echo "--theme=Dracula"
|
|
138
136
|
;;
|
|
139
|
-
|
|
137
|
+
auto)
|
|
140
138
|
# auto - let bat detect
|
|
141
139
|
echo ""
|
|
142
140
|
;;
|
|
141
|
+
*)
|
|
142
|
+
# light is default
|
|
143
|
+
echo "--theme=GitHub"
|
|
144
|
+
;;
|
|
143
145
|
esac
|
|
144
146
|
}
|
|
145
147
|
|
package/commands/commit.sh
CHANGED
|
@@ -134,9 +134,7 @@ EOF
|
|
|
134
134
|
return 1
|
|
135
135
|
fi
|
|
136
136
|
|
|
137
|
-
local type_options
|
|
138
|
-
type_options=$(cat << 'TYPES'
|
|
139
|
-
feat - A new feature
|
|
137
|
+
local type_options="feat - A new feature
|
|
140
138
|
fix - A bug fix
|
|
141
139
|
docs - Documentation only changes
|
|
142
140
|
style - Code style changes (formatting, whitespace)
|
|
@@ -145,9 +143,7 @@ perf - Performance improvement
|
|
|
145
143
|
test - Adding or fixing tests
|
|
146
144
|
build - Build system or dependency changes
|
|
147
145
|
ci - CI/CD configuration changes
|
|
148
|
-
chore - Other changes that don't modify src/test files
|
|
149
|
-
TYPES
|
|
150
|
-
)
|
|
146
|
+
chore - Other changes that don't modify src/test files"
|
|
151
147
|
|
|
152
148
|
local selected_type
|
|
153
149
|
selected_type=$(echo "$type_options" | fzf --prompt="Commit type > " \
|
package/commands/create.sh
CHANGED
|
@@ -172,40 +172,42 @@ TYPES
|
|
|
172
172
|
fi
|
|
173
173
|
else
|
|
174
174
|
# Interactive mode
|
|
175
|
-
echo "Enter Jira link (e.g., https://jira.company.com/browse/PROJ-123):"
|
|
175
|
+
echo "Enter Jira link (e.g., https://jira.company.com/browse/PROJ-123) or press Enter to skip:"
|
|
176
176
|
prompt_read " > " jira_link
|
|
177
177
|
fi
|
|
178
178
|
|
|
179
|
-
if [[ -z "$jira_link" ]]; then
|
|
180
|
-
echo "Error: No Jira link provided."
|
|
181
|
-
return 1
|
|
182
|
-
fi
|
|
183
|
-
|
|
184
179
|
# -----------------------------
|
|
185
180
|
# 2. Parse issue number from Jira link
|
|
186
181
|
# -----------------------------
|
|
187
182
|
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
183
|
|
|
191
|
-
|
|
192
|
-
|
|
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."
|
|
184
|
+
if [[ -z "$jira_link" ]]; then
|
|
185
|
+
# No Jira link provided, use NOISSUE
|
|
200
186
|
issue_number="NOISSUE"
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
187
|
+
print_info "No Jira link provided. Using NOISSUE."
|
|
188
|
+
else
|
|
189
|
+
# First try to match just the issue number pattern (e.g., PROJ-123)
|
|
190
|
+
issue_number=$(echo "$jira_link" | grep -o -E '^[A-Z]+-[0-9]+$' | head -1)
|
|
191
|
+
|
|
192
|
+
# If not a direct match, try to extract from URL
|
|
193
|
+
if [[ -z "$issue_number" ]]; then
|
|
194
|
+
# Match patterns like PROJ-123, ABC-456, etc.
|
|
195
|
+
# Supports both /browse/PROJ-123 and selectedIssue=PROJ-123 formats
|
|
196
|
+
issue_number=$(echo "$jira_link" | grep -o -E '(browse/|selectedIssue=)[A-Z]+-[0-9]+' | grep -o '[A-Z]\+-[0-9]\+' | head -1)
|
|
197
|
+
fi
|
|
198
|
+
|
|
199
|
+
if [[ -z "$issue_number" ]]; then
|
|
200
|
+
print_warning "Could not parse issue number from Jira link. Using NOISSUE."
|
|
201
|
+
issue_number="NOISSUE"
|
|
202
|
+
# If parsing failed and we had arguments, include the first arg in the title
|
|
203
|
+
if [[ -n "$branch_title" ]]; then
|
|
204
|
+
branch_title="$jira_link $branch_title"
|
|
205
|
+
else
|
|
206
|
+
branch_title="$jira_link"
|
|
207
|
+
fi
|
|
204
208
|
else
|
|
205
|
-
|
|
209
|
+
echo "Parsed issue number: $issue_number"
|
|
206
210
|
fi
|
|
207
|
-
else
|
|
208
|
-
echo "Parsed issue number: $issue_number"
|
|
209
211
|
fi
|
|
210
212
|
echo
|
|
211
213
|
|