You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
3.9 KiB

  1. /* Copyright 2020 Guillaume Gérard
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "git.h"
  17. bool process_record_git(uint16_t keycode, keyrecord_t *record) {
  18. switch (keycode) {
  19. case GIT_ADD:
  20. if (record->event.pressed) {
  21. SEND_STRING("git add ");
  22. }
  23. return false;
  24. case GIT_BRANCH:
  25. if (record->event.pressed) {
  26. SEND_STRING("git branch ");
  27. }
  28. return false;
  29. case GIT_CHECKOUT:
  30. if (record->event.pressed) {
  31. SEND_STRING("git checkout ");
  32. }
  33. return false;
  34. case GIT_CHERRYPICK:
  35. if (record->event.pressed) {
  36. SEND_STRING("git cherry-pick ");
  37. }
  38. return false;
  39. case GIT_COMMIT:
  40. if (record->event.pressed) {
  41. SEND_STRING("git commit -m \"\""SS_TAP(X_LEFT));
  42. }
  43. return false;
  44. case GIT_DIFF:
  45. if (record->event.pressed) {
  46. SEND_STRING("git diff ");
  47. }
  48. return false;
  49. case GIT_FETCH:
  50. if (record->event.pressed) {
  51. SEND_STRING("git fetch ");
  52. }
  53. return false;
  54. case GIT_GREP:
  55. if (record->event.pressed) {
  56. SEND_STRING("git grep ");
  57. }
  58. return false;
  59. case GIT_LOG:
  60. if (record->event.pressed) {
  61. SEND_STRING("git log --decorate --oneline --graph ");
  62. }
  63. return false;
  64. case GIT_INIT:
  65. if (record->event.pressed) {
  66. SEND_STRING("git init ");
  67. }
  68. return false;
  69. case GIT_MV:
  70. if (record->event.pressed) {
  71. SEND_STRING("git mv ");
  72. }
  73. return false;
  74. case GIT_MERGE:
  75. if (record->event.pressed) {
  76. SEND_STRING("git merge ");
  77. }
  78. return false;
  79. case GIT_PUSH:
  80. if (record->event.pressed) {
  81. SEND_STRING("git push ");
  82. }
  83. return false;
  84. case GIT_PULL:
  85. if (record->event.pressed) {
  86. SEND_STRING("git pull ");
  87. }
  88. return false;
  89. case GIT_REBASE:
  90. if (record->event.pressed) {
  91. SEND_STRING("git rebase ");
  92. }
  93. return false;
  94. case GIT_REMOTE:
  95. if (record->event.pressed) {
  96. SEND_STRING("git remote ");
  97. }
  98. return false;
  99. case GIT_RESET:
  100. if (record->event.pressed) {
  101. SEND_STRING("git reset ");
  102. }
  103. return false;
  104. case GIT_SHOW:
  105. if (record->event.pressed) {
  106. SEND_STRING("git show ");
  107. }
  108. return false;
  109. case GIT_STASH:
  110. if (record->event.pressed) {
  111. SEND_STRING("git stash ");
  112. }
  113. return false;
  114. case GIT_STATUS:
  115. if (record->event.pressed) {
  116. SEND_STRING("git status ");
  117. }
  118. return false;
  119. case GIT_TAG:
  120. if (record->event.pressed) {
  121. SEND_STRING("git tag ");
  122. }
  123. return false;
  124. }
  125. return true;
  126. }