A fork of RinRi's CPSRC. A tool for C++ Competitive programmers to do stuff
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

63 lignes
1.6 KiB

  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