ovictoraurelio

Untitled

Sep 6th, 2022
1,205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.22 KB | Source Code | 0 0
  1. #!/bin/bash
  2.  
  3. # declare -a projects=$(ls -d */)
  4. # declare -a projects=$(find . -maxdepth 1 -type d)
  5. # declare -a projects=$(ls -d */ | cut -f1 -d'/')
  6.  
  7. function p {
  8.     printf "\n\t${wht}$1$2$3"
  9. }
  10. function doing {
  11.     printf "\n\t${blu}$1$2$3"
  12. }
  13. function finished {
  14.     printf "\n\t${gre}$1$2$3${wht}\n"
  15. }
  16. function warn {
  17.     printf "\n\t${yel}$1$2$3"
  18. }
  19. function error {
  20.     printf "\n\n\t${red}$1$2$3${wht}"
  21. }
  22.  
  23. function insideFolderCheckStatus {
  24.     # p "The projects are: $projects"
  25.     if [[ -z $(git status -s) ]]; then
  26.         finished "Already nothing to commit"
  27.     else
  28.         warn "Oops! Are uncommited things\n"
  29.         git diff-index HEAD
  30.         ALL_PROJECTS_COMMITED=false
  31.     fi
  32. }
  33.  
  34. function checkIfThingsNotCommited {
  35.     ALL_PROJECTS_COMMITED=true
  36.     doing "Checking for uncommited things"
  37.     if [ -z $1 ]; then
  38. #        for project in "${projects[@]}"
  39.         for project in */
  40.         do
  41.             p "Checking status for: ${project}"
  42.             cd ".${WORKDIR}/${project}"
  43.             insideFolderCheckStatus
  44.             cd ..
  45.         done
  46.     else
  47.         p "Checking status for: "
  48.         cd "$WORKDIR/quoti$1"
  49.         insideFolderCheckStatus
  50.     fi
  51. }
  52.  
  53. checkIfThingsNotCommited
Advertisement
Add Comment
Please, Sign In to add comment