diff options
Diffstat (limited to 'docs/cli_commands.md')
| -rw-r--r-- | docs/cli_commands.md | 247 |
1 files changed, 247 insertions, 0 deletions
diff --git a/docs/cli_commands.md b/docs/cli_commands.md new file mode 100644 index 000000000..bffa8263e --- /dev/null +++ b/docs/cli_commands.md | |||
| @@ -0,0 +1,247 @@ | |||
| 1 | # QMK CLI Commands | ||
| 2 | |||
| 3 | # CLI Commands | ||
| 4 | |||
| 5 | ## `qmk cformat` | ||
| 6 | |||
| 7 | This command formats C code using clang-format. | ||
| 8 | |||
| 9 | 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>` | ||
| 10 | |||
| 11 | Run it with `-a` to format all core code, or pass filenames on the command line to run it on specific files. | ||
| 12 | |||
| 13 | **Usage for specified files**: | ||
| 14 | |||
| 15 | ``` | ||
| 16 | qmk cformat [file1] [file2] [...] [fileN] | ||
| 17 | ``` | ||
| 18 | |||
| 19 | **Usage for all core files**: | ||
| 20 | |||
| 21 | ``` | ||
| 22 | qmk cformat -a | ||
| 23 | ``` | ||
| 24 | |||
| 25 | **Usage for only changed files against origin/master**: | ||
| 26 | |||
| 27 | ``` | ||
| 28 | qmk cformat | ||
| 29 | ``` | ||
| 30 | |||
| 31 | **Usage for only changed files against branch_name**: | ||
| 32 | |||
| 33 | ``` | ||
| 34 | qmk cformat -b branch_name | ||
| 35 | ``` | ||
| 36 | |||
| 37 | ## `qmk compile` | ||
| 38 | |||
| 39 | 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. | ||
| 40 | |||
| 41 | **Usage for Configurator Exports**: | ||
| 42 | |||
| 43 | ``` | ||
| 44 | qmk compile <configuratorExport.json> | ||
| 45 | ``` | ||
| 46 | |||
| 47 | **Usage for Keymaps**: | ||
| 48 | |||
| 49 | ``` | ||
| 50 | qmk compile -kb <keyboard_name> -km <keymap_name> | ||
| 51 | ``` | ||
| 52 | |||
| 53 | **Usage in Keyboard Directory**: | ||
| 54 | |||
| 55 | Must be in keyboard directory with a default keymap, or in keymap directory for keyboard, or supply one with `--keymap <keymap_name>` | ||
| 56 | ``` | ||
| 57 | qmk compile | ||
| 58 | ``` | ||
| 59 | |||
| 60 | **Example**: | ||
| 61 | ``` | ||
| 62 | $ qmk config compile.keymap=default | ||
| 63 | $ cd ~/qmk_firmware/keyboards/planck/rev6 | ||
| 64 | $ qmk compile | ||
| 65 | Ψ Compiling keymap with make planck/rev6:default | ||
| 66 | ... | ||
| 67 | ``` | ||
| 68 | or with optional keymap argument | ||
| 69 | |||
| 70 | ``` | ||
| 71 | $ cd ~/qmk_firmware/keyboards/clueboard/66/rev4 | ||
| 72 | $ qmk compile -km 66_iso | ||
| 73 | Ψ Compiling keymap with make clueboard/66/rev4:66_iso | ||
| 74 | ... | ||
| 75 | ``` | ||
| 76 | or in keymap directory | ||
| 77 | |||
| 78 | ``` | ||
| 79 | $ cd ~/qmk_firmware/keyboards/gh60/satan/keymaps/colemak | ||
| 80 | $ qmk compile | ||
| 81 | Ψ Compiling keymap with make make gh60/satan:colemak | ||
| 82 | ... | ||
| 83 | ``` | ||
| 84 | |||
| 85 | **Usage in Layout Directory**: | ||
| 86 | |||
| 87 | Must be under `qmk_firmware/layouts/`, and in a keymap folder. | ||
| 88 | ``` | ||
| 89 | qmk compile -kb <keyboard_name> | ||
| 90 | ``` | ||
| 91 | |||
| 92 | **Example**: | ||
| 93 | ``` | ||
| 94 | $ cd ~/qmk_firmware/layouts/community/60_ansi/mechmerlin-ansi | ||
| 95 | $ qmk compile -kb dz60 | ||
| 96 | Ψ Compiling keymap with make dz60:mechmerlin-ansi | ||
| 97 | ... | ||
| 98 | ``` | ||
| 99 | |||
| 100 | ## `qmk flash` | ||
| 101 | |||
| 102 | This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default. | ||
| 103 | To specify a different bootloader, use `-bl <bootloader>`. Visit the [Flashing Firmware](flashing.md) guide for more details of the available bootloaders. | ||
| 104 | |||
| 105 | **Usage for Configurator Exports**: | ||
| 106 | |||
| 107 | ``` | ||
| 108 | qmk flash <configuratorExport.json> -bl <bootloader> | ||
| 109 | ``` | ||
| 110 | |||
| 111 | **Usage for Keymaps**: | ||
| 112 | |||
| 113 | ``` | ||
| 114 | qmk flash -kb <keyboard_name> -km <keymap_name> -bl <bootloader> | ||
| 115 | ``` | ||
| 116 | |||
| 117 | **Listing the Bootloaders** | ||
| 118 | |||
| 119 | ``` | ||
| 120 | qmk flash -b | ||
| 121 | ``` | ||
| 122 | |||
| 123 | ## `qmk config` | ||
| 124 | |||
| 125 | This command lets you configure the behavior of QMK. For the full `qmk config` documentation see [CLI Configuration](cli_configuration.md). | ||
| 126 | |||
| 127 | **Usage**: | ||
| 128 | |||
| 129 | ``` | ||
| 130 | qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN] | ||
| 131 | ``` | ||
| 132 | |||
| 133 | ## `qmk docs` | ||
| 134 | |||
| 135 | This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936. | ||
| 136 | |||
| 137 | **Usage**: | ||
| 138 | |||
| 139 | ``` | ||
| 140 | qmk docs [-p PORT] | ||
| 141 | ``` | ||
| 142 | |||
| 143 | ## `qmk doctor` | ||
| 144 | |||
| 145 | 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. | ||
| 146 | |||
| 147 | **Usage**: | ||
| 148 | |||
| 149 | ``` | ||
| 150 | qmk doctor [-y] [-n] | ||
| 151 | ``` | ||
| 152 | |||
| 153 | **Examples**: | ||
| 154 | |||
| 155 | Check your environment for problems and prompt to fix them: | ||
| 156 | |||
| 157 | qmk doctor | ||
| 158 | |||
| 159 | Check your environment and automatically fix any problems found: | ||
| 160 | |||
| 161 | qmk doctor -y | ||
| 162 | |||
| 163 | Check your environment and report problems only: | ||
| 164 | |||
| 165 | qmk doctor -n | ||
| 166 | |||
| 167 | ## `qmk json2c` | ||
| 168 | |||
| 169 | Creates a keymap.c from a QMK Configurator export. | ||
| 170 | |||
| 171 | **Usage**: | ||
| 172 | |||
| 173 | ``` | ||
| 174 | qmk json2c [-o OUTPUT] filename | ||
| 175 | ``` | ||
| 176 | |||
| 177 | ## `qmk kle2json` | ||
| 178 | |||
| 179 | 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. | ||
| 180 | |||
| 181 | **Usage**: | ||
| 182 | |||
| 183 | ``` | ||
| 184 | qmk kle2json [-f] <filename> | ||
| 185 | ``` | ||
| 186 | |||
| 187 | **Examples**: | ||
| 188 | |||
| 189 | ``` | ||
| 190 | $ qmk kle2json kle.txt | ||
| 191 | ☒ File info.json already exists, use -f or --force to overwrite. | ||
| 192 | ``` | ||
| 193 | |||
| 194 | ``` | ||
| 195 | $ qmk kle2json -f kle.txt -f | ||
| 196 | Ψ Wrote out to info.json | ||
| 197 | ``` | ||
| 198 | |||
| 199 | ## `qmk list-keyboards` | ||
| 200 | |||
| 201 | This command lists all the keyboards currently defined in `qmk_firmware` | ||
| 202 | |||
| 203 | **Usage**: | ||
| 204 | |||
| 205 | ``` | ||
| 206 | qmk list-keyboards | ||
| 207 | ``` | ||
| 208 | |||
| 209 | ## `qmk list-keymaps` | ||
| 210 | |||
| 211 | This command lists all the keymaps for a specified keyboard (and revision). | ||
| 212 | |||
| 213 | **Usage**: | ||
| 214 | |||
| 215 | ``` | ||
| 216 | qmk list-keymaps -kb planck/ez | ||
| 217 | ``` | ||
| 218 | |||
| 219 | ## `qmk new-keymap` | ||
| 220 | |||
| 221 | This command creates a new keymap based on a keyboard's existing default keymap. | ||
| 222 | |||
| 223 | **Usage**: | ||
| 224 | |||
| 225 | ``` | ||
| 226 | qmk new-keymap [-kb KEYBOARD] [-km KEYMAP] | ||
| 227 | ``` | ||
| 228 | |||
| 229 | ## `qmk pyformat` | ||
| 230 | |||
| 231 | This command formats python code in `qmk_firmware`. | ||
| 232 | |||
| 233 | **Usage**: | ||
| 234 | |||
| 235 | ``` | ||
| 236 | qmk pyformat | ||
| 237 | ``` | ||
| 238 | |||
| 239 | ## `qmk pytest` | ||
| 240 | |||
| 241 | This command runs the python test suite. If you make changes to python code you should ensure this runs successfully. | ||
| 242 | |||
| 243 | **Usage**: | ||
| 244 | |||
| 245 | ``` | ||
| 246 | qmk pytest | ||
| 247 | ``` | ||
