@san-siva/gitsy 1.0.13 → 1.0.15
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/g-diff +42 -7
- package/bin/g-wr +3 -4
- package/bin/utils +2 -0
- package/package.json +1 -1
package/bin/g-diff
CHANGED
|
@@ -20,6 +20,7 @@ target_branch=""
|
|
|
20
20
|
source_branch=""
|
|
21
21
|
full_diff=false
|
|
22
22
|
files_only=false
|
|
23
|
+
output_file=""
|
|
23
24
|
|
|
24
25
|
set_flags() {
|
|
25
26
|
while [ $# -gt 0 ]; do
|
|
@@ -35,7 +36,8 @@ set_flags() {
|
|
|
35
36
|
echo "--source-branch BRANCH, --source-branch=BRANCH, -s=BRANCH, -s BRANCH specify the source branch (defaults to current branch)"
|
|
36
37
|
echo "-f, --full show full diff and copy to clipboard"
|
|
37
38
|
echo "--files-only show only file names (no stats, no clipboard)"
|
|
38
|
-
|
|
39
|
+
echo "-o FILE, --output-file FILE, --output-file=FILE write output to file instead of clipboard"
|
|
40
|
+
exit 0
|
|
39
41
|
;;
|
|
40
42
|
-f | --full)
|
|
41
43
|
full_diff=true
|
|
@@ -43,6 +45,24 @@ set_flags() {
|
|
|
43
45
|
--files-only)
|
|
44
46
|
files_only=true
|
|
45
47
|
;;
|
|
48
|
+
-o=* | --output-file=*)
|
|
49
|
+
output_file="${1#*=}"
|
|
50
|
+
if [ -z "$output_file" ]; then
|
|
51
|
+
print_message "" -1
|
|
52
|
+
print_message "${RED}Error: No output file specified.${NC}" -1
|
|
53
|
+
exit 1
|
|
54
|
+
fi
|
|
55
|
+
;;
|
|
56
|
+
-o | --output-file)
|
|
57
|
+
shift
|
|
58
|
+
if [ $# -gt 0 ]; then
|
|
59
|
+
output_file="$1"
|
|
60
|
+
else
|
|
61
|
+
print_message "" -1
|
|
62
|
+
print_message "${RED}Error: No output file specified.${NC}" -1
|
|
63
|
+
exit 1
|
|
64
|
+
fi
|
|
65
|
+
;;
|
|
46
66
|
-t=* | --target-branch=*)
|
|
47
67
|
target_branch="${1#*=}"
|
|
48
68
|
if [ -z "$target_branch" ]; then
|
|
@@ -164,11 +184,16 @@ show_full_diff() {
|
|
|
164
184
|
fi
|
|
165
185
|
echo "$formatted_output" | indent
|
|
166
186
|
|
|
167
|
-
#
|
|
168
|
-
local
|
|
169
|
-
|
|
187
|
+
# Strip color codes for file/clipboard output
|
|
188
|
+
local plain_content
|
|
189
|
+
plain_content=$(sed $'s/\033\[[0-9;]*m//g' <<< "${formatted_output}")
|
|
170
190
|
if [ $? -eq 0 ]; then
|
|
171
|
-
|
|
191
|
+
if [ -n "$output_file" ]; then
|
|
192
|
+
echo "$plain_content" > "$output_file"
|
|
193
|
+
print_message "${BLUE}Formatted diff written to ${NC}${output_file}${BLUE}.${NC}"
|
|
194
|
+
else
|
|
195
|
+
copy_to_clipboard "$plain_content" "Formatted diff copied to clipboard."
|
|
196
|
+
fi
|
|
172
197
|
fi
|
|
173
198
|
else
|
|
174
199
|
print_message "${BLUE}No changes found between ${NC}${source_branch}${BLUE} and ${NC}${target_branch}${BLUE}.${NC}"
|
|
@@ -186,7 +211,12 @@ show_files_only() {
|
|
|
186
211
|
|
|
187
212
|
if [ -n "$filenames" ]; then
|
|
188
213
|
echo "$filenames" | indent
|
|
189
|
-
|
|
214
|
+
if [ -n "$output_file" ]; then
|
|
215
|
+
echo "$filenames" > "$output_file"
|
|
216
|
+
print_message "${BLUE}Filenames written to ${NC}${output_file}${BLUE}.${NC}"
|
|
217
|
+
else
|
|
218
|
+
copy_to_clipboard "$filenames" "Filenames copied to clipboard."
|
|
219
|
+
fi
|
|
190
220
|
else
|
|
191
221
|
print_message "${BLUE}No changes found between ${NC}${source_branch}${BLUE} and ${NC}${target_branch}${BLUE}.${NC}"
|
|
192
222
|
fi
|
|
@@ -211,7 +241,12 @@ show_stat_summary() {
|
|
|
211
241
|
print_message "${RED}Failed to generate stats for clipboard. [Fail]${NC}" -1
|
|
212
242
|
return 1
|
|
213
243
|
fi
|
|
214
|
-
|
|
244
|
+
if [ -n "$output_file" ]; then
|
|
245
|
+
echo "$stats_content" > "$output_file"
|
|
246
|
+
print_message "${BLUE}Stats written to ${NC}${output_file}${BLUE}.${NC}"
|
|
247
|
+
else
|
|
248
|
+
copy_to_clipboard "$stats_content" "Stats copied to clipboard."
|
|
249
|
+
fi
|
|
215
250
|
else
|
|
216
251
|
print_message "${BLUE}No changes found between ${NC}${source_branch}${BLUE} and ${NC}${target_branch}${BLUE}.${NC}"
|
|
217
252
|
fi
|
package/bin/g-wr
CHANGED
|
@@ -240,11 +240,10 @@ main() {
|
|
|
240
240
|
validate_dependencies git figlet lolcat
|
|
241
241
|
print_banner
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
local step_number=2
|
|
243
|
+
local step_number=1
|
|
246
244
|
if [ "$stash" = true ]; then
|
|
247
|
-
step_number
|
|
245
|
+
stash_changes $stash $step_number
|
|
246
|
+
step_number=2
|
|
248
247
|
fi
|
|
249
248
|
|
|
250
249
|
if [ -n "$worktree_name" ]; then
|
package/bin/utils
CHANGED
|
@@ -323,6 +323,7 @@ create_worktree() {
|
|
|
323
323
|
fi
|
|
324
324
|
|
|
325
325
|
print_message "${created_worktree_message}"
|
|
326
|
+
copy_to_clipboard "cd ${worktree_path}" "cd ${worktree_path} copied to clipboard."
|
|
326
327
|
return 0
|
|
327
328
|
fi
|
|
328
329
|
|
|
@@ -339,6 +340,7 @@ create_worktree() {
|
|
|
339
340
|
fi
|
|
340
341
|
|
|
341
342
|
print_message "${created_worktree_message}"
|
|
343
|
+
copy_to_clipboard "cd ${worktree_path}" "cd ${worktree_path} copied to clipboard."
|
|
342
344
|
return 0
|
|
343
345
|
}
|
|
344
346
|
|