-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgit-commit-prompt.bat
More file actions
executable file
·65 lines (46 loc) · 1.86 KB
/
git-commit-prompt.bat
File metadata and controls
executable file
·65 lines (46 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /usr/bin/env bash
@echo off
box_text() {
local text="$1"
local length=${#text}
local width=40 # Adjust this value based on your desired width
# Calculate padding for centering
local padding=$(( (width - length) / 2 ))
# Array of ANSI color codes
local colors=("\e[1;31m" "\e[1;32m" "\e[1;33m" "\e[1;34m" "\e[1;35m" "\e[1;36m")
# Select a random color from the array
local random_color=${colors[$((RANDOM % ${#colors[@]}))]}
# Draw the box with random color
echo "┌────────────────────────────────────────┐"
printf "${random_color}│%*s%s%*s│\e[0m\n" "$padding" "" "$text" "$padding" ""
echo "└────────────────────────────────────────┘"
}
# Clear the console
clear
# Create a temporary directory named 'temp'
mkdir temp
# List the names of files that have changed and save to 'temp/changed-files.txt'
git diff --name-only > temp/changed-files.txt
# List untracked files and save to 'temp/untracked-files.txt'
git ls-files --others --exclude-standard > temp/untracked-files.txt
# Set the NODE_ENV environment variable to "development"
export NODE_ENV="development"
# List all Git branches
box_text ".GIT BRANCHES "
git branch
# Show details about the last commit
box_text ".GIT SHOW "
git show --pretty=medium --abbrev-commit --no-patch
# Show the current Git status
box_text ".GIT STATE "
git status
# Display a message indicating the beginning of structuring Git commit messages
echo ""
echo Structuring Git commit message...
echo ""
box_text "> GIT COMMIT PROMPT UTILITY "
echo ""
# Run a Node.js script located at 'src/index.js' for Git commit message structuring
node src/index.js
# Display the last 10 commit messages in one line
git log --oneline -10