A fork of RinRi's CPSRC. A tool for C++ Competitive programmers to do stuff
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
4 年前
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. echo "Your preferred text editor (type in package that will be used, as per your package manager:"
  2. read editor
  3. echo "Set your editor as $editor"
  4. read -r -p "${1:-Is your editor's package name different from its binary name (e.g. python-pip and pip)? [y/N]} " response
  5. case "$response" in
  6. [yY][eE][sS]|[yY])
  7. echo "Enter your editor's package name"
  8. read editorPACKAGE
  9. echo "set editor PACKAGE as $editorPACKAGE"
  10. ;;
  11. *)
  12. editorPACKAGE=$editor
  13. echo "Setting editor PACKAGE as $editorPACKAGE"
  14. ;;
  15. esac
  16. echo "Your distro? ( 1)Arch, 2)Debian): "
  17. read distro
  18. if [ $distro -eq 1 ]
  19. then
  20. sudo pacman -Syu g++ $editorPACKAGE
  21. elif [ $distro -eq 2 ]
  22. then
  23. sudo apt update
  24. sudo apt upgrade
  25. sudo apt install g++ $editorPACKAGE
  26. else
  27. echo "Please install/update these packages manually: $editorPACKAGE, G++"
  28. read -p "Press enter to continue" A
  29. fi
  30. read -r -p "${1:-Set custom directory for code? [y/N]} " response
  31. case "$response" in
  32. [yY][eE][sS]|[yY])
  33. echo "Enter directory for files:"
  34. read DIR
  35. echo "set dir as $DIR"
  36. ;;
  37. *)
  38. DIR='.'
  39. echo "Setting this directory ($DIR)"
  40. ;;
  41. esac
  42. # create.sh
  43. echo $'cp template.cpp $1.cpp \n' > $DIR/create.sh
  44. printf "$editor " >> $DIR/create.sh
  45. printf '$1.cpp ' >> $DIR/create.sh
  46. # template
  47. read -p "Press enter to create template" A
  48. $editor $DIR/template.cpp
  49. # run.sh
  50. echo $'g++ -o $1.out -g $1.cpp\n./$1.out' > $DIR/run.sh
  51. # make all executable
  52. chmod +x $DIR/create.sh
  53. chmod +x $DIR/run.sh