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.

291 lines
6.1 KiB

  1. # QMK CLI Commands
  2. # User Commands
  3. ## `qmk compile`
  4. This command allows you to compile firmware from any directory. You can compile JSON exports from <https://config.qmk.fm>, compile keymaps in the repo, or compile the keyboard in the current working directory.
  5. This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
  6. **Usage for Configurator Exports**:
  7. ```
  8. qmk compile <configuratorExport.json>
  9. ```
  10. **Usage for Keymaps**:
  11. ```
  12. qmk compile -kb <keyboard_name> -km <keymap_name>
  13. ```
  14. **Usage in Keyboard Directory**:
  15. Must be in keyboard directory with a default keymap, or in keymap directory for keyboard, or supply one with `--keymap <keymap_name>`
  16. ```
  17. qmk compile
  18. ```
  19. **Usage for building all keyboards that support a specific keymap**:
  20. ```
  21. qmk compile -kb all -km <keymap_name>
  22. ```
  23. **Example**:
  24. ```
  25. $ qmk config compile.keymap=default
  26. $ cd ~/qmk_firmware/keyboards/planck/rev6
  27. $ qmk compile
  28. Ψ Compiling keymap with make planck/rev6:default
  29. ...
  30. ```
  31. or with optional keymap argument
  32. ```
  33. $ cd ~/qmk_firmware/keyboards/clueboard/66/rev4
  34. $ qmk compile -km 66_iso
  35. Ψ Compiling keymap with make clueboard/66/rev4:66_iso
  36. ...
  37. ```
  38. or in keymap directory
  39. ```
  40. $ cd ~/qmk_firmware/keyboards/gh60/satan/keymaps/colemak
  41. $ qmk compile
  42. Ψ Compiling keymap with make make gh60/satan:colemak
  43. ...
  44. ```
  45. **Usage in Layout Directory**:
  46. Must be under `qmk_firmware/layouts/`, and in a keymap folder.
  47. ```
  48. qmk compile -kb <keyboard_name>
  49. ```
  50. **Example**:
  51. ```
  52. $ cd ~/qmk_firmware/layouts/community/60_ansi/mechmerlin-ansi
  53. $ qmk compile -kb dz60
  54. Ψ Compiling keymap with make dz60:mechmerlin-ansi
  55. ...
  56. ```
  57. ## `qmk flash`
  58. This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default. To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing.md) guide for more details of the available bootloaders.
  59. This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
  60. **Usage for Configurator Exports**:
  61. ```
  62. qmk flash <configuratorExport.json> -bl <bootloader>
  63. ```
  64. **Usage for Keymaps**:
  65. ```
  66. qmk flash -kb <keyboard_name> -km <keymap_name> -bl <bootloader>
  67. ```
  68. **Listing the Bootloaders**
  69. ```
  70. qmk flash -b
  71. ```
  72. ## `qmk config`
  73. This command lets you configure the behavior of QMK. For the full `qmk config` documentation see [CLI Configuration](cli_configuration.md).
  74. **Usage**:
  75. ```
  76. qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN]
  77. ```
  78. ## `qmk doctor`
  79. This command examines your environment and alerts you to potential build or flash problems. It can fix many of them if you want it to.
  80. **Usage**:
  81. ```
  82. qmk doctor [-y] [-n]
  83. ```
  84. **Examples**:
  85. Check your environment for problems and prompt to fix them:
  86. qmk doctor
  87. Check your environment and automatically fix any problems found:
  88. qmk doctor -y
  89. Check your environment and report problems only:
  90. qmk doctor -n
  91. ## `qmk info`
  92. Displays information about keyboards and keymaps in QMK. You can use this to get information about a keyboard, show the layouts, display the underlying key matrix, or to pretty-print JSON keymaps.
  93. **Usage**:
  94. ```
  95. qmk info [-f FORMAT] [-m] [-l] [-km KEYMAP] [-kb KEYBOARD]
  96. ```
  97. This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
  98. **Examples**:
  99. Show basic information for a keyboard:
  100. qmk info -kb planck/rev5
  101. Show the matrix for a keyboard:
  102. qmk info -kb ergodox_ez -m
  103. Show a JSON keymap for a keyboard:
  104. qmk info -kb clueboard/california -km default
  105. ## `qmk json2c`
  106. Creates a keymap.c from a QMK Configurator export.
  107. **Usage**:
  108. ```
  109. qmk json2c [-o OUTPUT] filename
  110. ```
  111. ## `qmk list-keyboards`
  112. This command lists all the keyboards currently defined in `qmk_firmware`
  113. **Usage**:
  114. ```
  115. qmk list-keyboards
  116. ```
  117. ## `qmk list-keymaps`
  118. This command lists all the keymaps for a specified keyboard (and revision).
  119. This command is directory aware. It will automatically fill in KEYBOARD if you are in a keyboard directory.
  120. **Usage**:
  121. ```
  122. qmk list-keymaps -kb planck/ez
  123. ```
  124. ## `qmk new-keymap`
  125. This command creates a new keymap based on a keyboard's existing default keymap.
  126. This command is directory aware. It will automatically fill in KEYBOARD and/or KEYMAP if you are in a keyboard or keymap directory.
  127. **Usage**:
  128. ```
  129. qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
  130. ```
  131. ---
  132. # Developer Commands
  133. ## `qmk cformat`
  134. This command formats C code using clang-format.
  135. Run it with no arguments to format all core code that has been changed. Default checks `origin/master` with `git diff`, branch can be changed using `-b <branch_name>`
  136. Run it with `-a` to format all core code, or pass filenames on the command line to run it on specific files.
  137. **Usage for specified files**:
  138. ```
  139. qmk cformat [file1] [file2] [...] [fileN]
  140. ```
  141. **Usage for all core files**:
  142. ```
  143. qmk cformat -a
  144. ```
  145. **Usage for only changed files against origin/master**:
  146. ```
  147. qmk cformat
  148. ```
  149. **Usage for only changed files against branch_name**:
  150. ```
  151. qmk cformat -b branch_name
  152. ```
  153. ## `qmk docs`
  154. This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936.
  155. **Usage**:
  156. ```
  157. qmk docs [-p PORT]
  158. ```
  159. ## `qmk kle2json`
  160. This command allows you to convert from raw KLE data to QMK Configurator JSON. It accepts either an absolute file path, or a file name in the current directory. By default it will not overwrite `info.json` if it is already present. Use the `-f` or `--force` flag to overwrite.
  161. **Usage**:
  162. ```
  163. qmk kle2json [-f] <filename>
  164. ```
  165. **Examples**:
  166. ```
  167. $ qmk kle2json kle.txt
  168. ☒ File info.json already exists, use -f or --force to overwrite.
  169. ```
  170. ```
  171. $ qmk kle2json -f kle.txt -f
  172. Ψ Wrote out to info.json
  173. ```
  174. ## `qmk pyformat`
  175. This command formats python code in `qmk_firmware`.
  176. **Usage**:
  177. ```
  178. qmk pyformat
  179. ```
  180. ## `qmk pytest`
  181. This command runs the python test suite. If you make changes to python code you should ensure this runs successfully.
  182. **Usage**:
  183. ```
  184. qmk pytest
  185. ```