diff options
| author | Erovia <erovia@users.noreply.github.com> | 2019-11-27 21:27:06 +0100 |
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2020-04-08 09:31:14 -0700 |
| commit | c61f016fa491502920941fd03cdab6453d126e67 (patch) | |
| tree | 1f8f6b4cbaf2b158604d47f01dc42fc69cac365a /docs/cli.md | |
| parent | ea7e40bae17897fbc613e0965d076a7a25b14ea6 (diff) | |
| download | qmk_firmware-c61f016fa491502920941fd03cdab6453d126e67.tar.gz qmk_firmware-c61f016fa491502920941fd03cdab6453d126e67.zip | |
CLI: Add development mode support
Hide development specific options and don't require dev modules unless
`user.developer` is set to `True`.
Diffstat (limited to 'docs/cli.md')
| -rw-r--r-- | docs/cli.md | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/docs/cli.md b/docs/cli.md index 760fe1cdb..625ac4fb7 100644 --- a/docs/cli.md +++ b/docs/cli.md | |||
| @@ -37,3 +37,253 @@ We are looking for people to create and maintain a `qmk` package for more operat | |||
| 37 | * Document why in a comment when you do deviate | 37 | * Document why in a comment when you do deviate |
| 38 | * Install using a virtualenv | 38 | * Install using a virtualenv |
| 39 | * Instruct the user to set the environment variable `QMK_HOME` to have the firmware source checked out somewhere other than `~/qmk_firmware`. | 39 | * Instruct the user to set the environment variable `QMK_HOME` to have the firmware source checked out somewhere other than `~/qmk_firmware`. |
| 40 | |||
| 41 | # Local CLI | ||
| 42 | |||
| 43 | If you do not want to use the global CLI there is a local CLI bundled with `qmk_firmware`. You can find it in `qmk_firmware/bin/qmk`. You can run the `qmk` command from any directory and it will always operate on that copy of `qmk_firmware`. | ||
| 44 | |||
| 45 | **Example**: | ||
| 46 | |||
| 47 | ``` | ||
| 48 | $ ~/qmk_firmware/bin/qmk hello | ||
| 49 | Ψ Hello, World! | ||
| 50 | ``` | ||
| 51 | |||
| 52 | ## Local CLI Limitations | ||
| 53 | |||
| 54 | There are some limitations to the local CLI compared to the global CLI: | ||
| 55 | |||
| 56 | * The local CLI does not support `qmk setup` or `qmk clone` | ||
| 57 | * The local CLI always operates on the same `qmk_firmware` tree, even if you have multiple repositories cloned. | ||
| 58 | * The local CLI does not run in a virtualenv, so it's possible that dependencies will conflict | ||
| 59 | |||
| 60 | # CLI Commands | ||
| 61 | |||
| 62 | ## `qmk cformat` | ||
| 63 | |||
| 64 | *dev mode* | ||
| 65 | |||
| 66 | This command formats C code using clang-format. Run it with no arguments to format all core code, or pass filenames on the command line to run it on specific files. | ||
| 67 | |||
| 68 | **Usage**: | ||
| 69 | |||
| 70 | ``` | ||
| 71 | qmk cformat [file1] [file2] [...] [fileN] | ||
| 72 | ``` | ||
| 73 | |||
| 74 | ## `qmk compile` | ||
| 75 | |||
| 76 | 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. | ||
| 77 | |||
| 78 | **Usage for Configurator Exports**: | ||
| 79 | |||
| 80 | ``` | ||
| 81 | qmk compile <configuratorExport.json> | ||
| 82 | ``` | ||
| 83 | |||
| 84 | **Usage for Keymaps**: | ||
| 85 | |||
| 86 | ``` | ||
| 87 | qmk compile -kb <keyboard_name> -km <keymap_name> | ||
| 88 | ``` | ||
| 89 | |||
| 90 | **Usage in Keyboard Directory**: | ||
| 91 | |||
| 92 | Must be in keyboard directory with a default keymap, or in keymap directory for keyboard, or supply one with `--keymap <keymap_name>` | ||
| 93 | ``` | ||
| 94 | qmk compile | ||
| 95 | ``` | ||
| 96 | |||
| 97 | **Example**: | ||
| 98 | ``` | ||
| 99 | $ qmk config compile.keymap=default | ||
| 100 | $ cd ~/qmk_firmware/keyboards/planck/rev6 | ||
| 101 | $ qmk compile | ||
| 102 | Ψ Compiling keymap with make planck/rev6:default | ||
| 103 | ... | ||
| 104 | ``` | ||
| 105 | or with optional keymap argument | ||
| 106 | |||
| 107 | ``` | ||
| 108 | $ cd ~/qmk_firmware/keyboards/clueboard/66/rev4 | ||
| 109 | $ qmk compile -km 66_iso | ||
| 110 | Ψ Compiling keymap with make clueboard/66/rev4:66_iso | ||
| 111 | ... | ||
| 112 | ``` | ||
| 113 | or in keymap directory | ||
| 114 | |||
| 115 | ``` | ||
| 116 | $ cd ~/qmk_firmware/keyboards/gh60/satan/keymaps/colemak | ||
| 117 | $ qmk compile | ||
| 118 | Ψ Compiling keymap with make make gh60/satan:colemak | ||
| 119 | ... | ||
| 120 | ``` | ||
| 121 | |||
| 122 | **Usage in Layout Directory**: | ||
| 123 | |||
| 124 | Must be under `qmk_firmware/layouts/`, and in a keymap folder. | ||
| 125 | ``` | ||
| 126 | qmk compile -kb <keyboard_name> | ||
| 127 | ``` | ||
| 128 | |||
| 129 | **Example**: | ||
| 130 | ``` | ||
| 131 | $ cd ~/qmk_firmware/layouts/community/60_ansi/mechmerlin-ansi | ||
| 132 | $ qmk compile -kb dz60 | ||
| 133 | Ψ Compiling keymap with make dz60:mechmerlin-ansi | ||
| 134 | ... | ||
| 135 | ``` | ||
| 136 | |||
| 137 | ## `qmk flash` | ||
| 138 | |||
| 139 | This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default. | ||
| 140 | To specify a different bootloader, use `-bl <bootloader>`. Visit <https://docs.qmk.fm/#/flashing> | ||
| 141 | for more details of the available bootloaders. | ||
| 142 | |||
| 143 | **Usage for Configurator Exports**: | ||
| 144 | |||
| 145 | ``` | ||
| 146 | qmk flash <configuratorExport.json> -bl <bootloader> | ||
| 147 | ``` | ||
| 148 | |||
| 149 | **Usage for Keymaps**: | ||
| 150 | |||
| 151 | ``` | ||
| 152 | qmk flash -kb <keyboard_name> -km <keymap_name> -bl <bootloader> | ||
| 153 | ``` | ||
| 154 | |||
| 155 | **Listing the Bootloaders** | ||
| 156 | |||
| 157 | ``` | ||
| 158 | qmk flash -b | ||
| 159 | ``` | ||
| 160 | |||
| 161 | ## `qmk config` | ||
| 162 | |||
| 163 | This command lets you configure the behavior of QMK. For the full `qmk config` documentation see [CLI Configuration](cli_configuration.md). | ||
| 164 | |||
| 165 | **Usage**: | ||
| 166 | |||
| 167 | ``` | ||
| 168 | qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN] | ||
| 169 | ``` | ||
| 170 | |||
| 171 | ## `qmk docs` | ||
| 172 | |||
| 173 | This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936. | ||
| 174 | |||
| 175 | **Usage**: | ||
| 176 | |||
| 177 | ``` | ||
| 178 | qmk docs [-p PORT] | ||
| 179 | ``` | ||
| 180 | |||
| 181 | ## `qmk doctor` | ||
| 182 | |||
| 183 | 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. | ||
| 184 | |||
| 185 | **Usage**: | ||
| 186 | |||
| 187 | ``` | ||
| 188 | qmk doctor [-y] [-n] | ||
| 189 | ``` | ||
| 190 | |||
| 191 | **Examples**: | ||
| 192 | |||
| 193 | Check your environment for problems and prompt to fix them: | ||
| 194 | |||
| 195 | qmk doctor | ||
| 196 | |||
| 197 | Check your environment and automatically fix any problems found: | ||
| 198 | |||
| 199 | qmk doctor -y | ||
| 200 | |||
| 201 | Check your environment and report problems only: | ||
| 202 | |||
| 203 | qmk doctor -n | ||
| 204 | |||
| 205 | ## `qmk json-keymap` | ||
| 206 | |||
| 207 | Creates a keymap.c from a QMK Configurator export. | ||
| 208 | |||
| 209 | **Usage**: | ||
| 210 | |||
| 211 | ``` | ||
| 212 | qmk json-keymap [-o OUTPUT] filename | ||
| 213 | ``` | ||
| 214 | |||
| 215 | ## `qmk kle2json` | ||
| 216 | |||
| 217 | 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. | ||
| 218 | |||
| 219 | **Usage**: | ||
| 220 | |||
| 221 | ``` | ||
| 222 | qmk kle2json [-f] <filename> | ||
| 223 | ``` | ||
| 224 | |||
| 225 | **Examples**: | ||
| 226 | |||
| 227 | ``` | ||
| 228 | $ qmk kle2json kle.txt | ||
| 229 | ☒ File info.json already exists, use -f or --force to overwrite. | ||
| 230 | ``` | ||
| 231 | |||
| 232 | ``` | ||
| 233 | $ qmk kle2json -f kle.txt -f | ||
| 234 | Ψ Wrote out to info.json | ||
| 235 | ``` | ||
| 236 | |||
| 237 | ## `qmk list-keyboards` | ||
| 238 | |||
| 239 | This command lists all the keyboards currently defined in `qmk_firmware` | ||
| 240 | |||
| 241 | **Usage**: | ||
| 242 | |||
| 243 | ``` | ||
| 244 | qmk list-keyboards | ||
| 245 | ``` | ||
| 246 | |||
| 247 | ## `qmk list-keymaps` | ||
| 248 | |||
| 249 | This command lists all the keymaps for a specified keyboard (and revision). | ||
| 250 | |||
| 251 | **Usage**: | ||
| 252 | |||
| 253 | ``` | ||
| 254 | qmk list-keymaps -kb planck/ez | ||
| 255 | ``` | ||
| 256 | |||
| 257 | ## `qmk new-keymap` | ||
| 258 | |||
| 259 | This command creates a new keymap based on a keyboard's existing default keymap. | ||
| 260 | |||
| 261 | **Usage**: | ||
| 262 | |||
| 263 | ``` | ||
| 264 | qmk new-keymap [-kb KEYBOARD] [-km KEYMAP] | ||
| 265 | ``` | ||
| 266 | |||
| 267 | ## `qmk pyformat` | ||
| 268 | |||
| 269 | *dev mode* | ||
| 270 | |||
| 271 | This command formats python code in `qmk_firmware`. | ||
| 272 | |||
| 273 | **Usage**: | ||
| 274 | |||
| 275 | ``` | ||
| 276 | qmk pyformat | ||
| 277 | ``` | ||
| 278 | |||
| 279 | ## `qmk pytest` | ||
| 280 | |||
| 281 | *dev mode* | ||
| 282 | |||
| 283 | This command runs the python test suite. If you make changes to python code you should ensure this runs successfully. | ||
| 284 | |||
| 285 | **Usage**: | ||
| 286 | |||
| 287 | ``` | ||
| 288 | qmk pytest | ||
| 289 | ``` | ||
