Guest User

Untitled

a guest
Jan 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. function do_one {
  2. cd $1
  3. pwd
  4. git $2
  5. echo ""
  6. cd ..
  7. }
  8.  
  9. function one_arg_do {
  10. if [ "$2" == "s" ] || [ "$2" == "st" ] || [ "$2" == "status" ]; then
  11. do_one $1 "status"
  12. elif [ "$2" == "d" ] || [ "$2" == "df" ] || [ "$2" == "diff" ]; then
  13. do_one $1 "diff"
  14. elif [ "$2" == "p" ] || [ "$2" == "pl" ] || [ "$2" == "pull" ]; then
  15. do_one $1 "pull"
  16. elif [ "$2" == "l" ] || [ "$2" == "log" ]; then
  17. do_one $1 "log"
  18. else
  19. echo "one_arg_do unsupported args: (git) $1 $2"
  20. fi
  21. }
  22.  
  23. function do_all {
  24. folders=(toybox_android wf_framework framework_words)
  25.  
  26. for folder in ${folders[*]}
  27. do
  28. one_arg_do $folder $1
  29. done
  30. }
  31.  
  32. numargs=$#
  33.  
  34. if [ "$1" == "help" ] || [ "$1" == "h" ]; then
  35. echo "Usage: zit [toy*|wf*|fr*] [s|st|status|d|df|diff|p|pl|pull|l|log]"
  36. exit
  37. else
  38. if [ $numargs == 0 ]; then
  39. do_all "status"
  40. elif [ $numargs == 1 ]; then
  41. case "$1" in
  42. to* )
  43. one_arg_do "toybox_android" "status";;
  44. wf* )
  45. one_arg_do "wf_framework" "status";;
  46. fr* )
  47. one_arg_do "framework_words" "status";;
  48. *)
  49. do_all "$1"
  50. esac
  51. elif [ $numargs == 2 ]; then
  52. case "$1" in
  53. to* )
  54. one_arg_do "toybox_android" $2;;
  55. wf* )
  56. one_arg_do "wf_framework" $2;;
  57. fr* )
  58. one_arg_do "framework_words" $2;;
  59. *)
  60. echo "2-arg-main: unsupported args: $1 $2";;
  61. esac
  62. else
  63. echo "main: wtf --> args: '$1' '$2'"
  64. fi
  65. fi
Add Comment
Please, Sign In to add comment