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.

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