Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 30 additions & 20 deletions g
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,36 @@
do_add() {
for file in "$PARAMS"
do
case $file in
*.js )
printf "$(tput setaf 1)"
node --check $file && git $CMD $file
printf "$(tput sgr0)"
;;
*.go )
printf "$(tput setaf 1)"
gofmt -e $file > /dev/null && git $CMD $file
printf "$(tput sgr0)"
;;
*.php )
printf "$(tput setaf 1)"
php -l $file && git $CMD $file
printf "$(tput sgr0)"
;;
* )
echo "$(tput setaf 3)Warning, file extension is Unchecked, please add a checker to g (https://github.com/dataf3l/g), with your help, we can have a world where nothing is Unchecked.$(tput sgr0)"
git $CMD $file
esac
printf "Are you sure you want to add $file ?[yes/no]"
read answer

while [ "$answer" != "yes" ] && [ "$answer" != "no" ]; do
printf "You need to answer 'yes' or 'no': "
read answer
done

if [ "$answer" = "yes" ]; then
case $file in
*.js )
printf "$(tput setaf 1)"
node --check $file && git $CMD $file
printf "$(tput sgr0)"
;;
*.go )
printf "$(tput setaf 1)"
gofmt -e $file > /dev/null && git $CMD $file
printf "$(tput sgr0)"
;;
*.php )
printf "$(tput setaf 1)"
php -l $file && git $CMD $file
printf "$(tput sgr0)"
;;
* )
echo "$(tput setaf 3)Warning, file extension is Unchecked, please add a checker to g (https://github.com/dataf3l/g), with your help, we can have a world where nothing is Unchecked.$(tput sgr0)"
git $CMD $file
esac
fi
done
}
main () {
Expand Down