aboutsummaryrefslogtreecommitdiff
path: root/docs/cli.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/cli.md')
-rw-r--r--docs/cli.md250
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
43If 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
54There 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
66This 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```
71qmk cformat [file1] [file2] [...] [fileN]
72```
73
74## `qmk compile`
75
76This 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```
81qmk compile <configuratorExport.json>
82```
83
84**Usage for Keymaps**:
85
86```
87qmk compile -kb <keyboard_name> -km <keymap_name>
88```
89
90**Usage in Keyboard Directory**:
91
92Must be in keyboard directory with a default keymap, or in keymap directory for keyboard, or supply one with `--keymap <keymap_name>`
93```
94qmk 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```
105or 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```
113or 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
124Must be under `qmk_firmware/layouts/`, and in a keymap folder.
125```
126qmk 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
139This command is similar to `qmk compile`, but can also target a bootloader. The bootloader is optional, and is set to `:flash` by default.
140To specify a different bootloader, use `-bl <bootloader>`. Visit <https://docs.qmk.fm/#/flashing>
141for more details of the available bootloaders.
142
143**Usage for Configurator Exports**:
144
145```
146qmk flash <configuratorExport.json> -bl <bootloader>
147```
148
149**Usage for Keymaps**:
150
151```
152qmk flash -kb <keyboard_name> -km <keymap_name> -bl <bootloader>
153```
154
155**Listing the Bootloaders**
156
157```
158qmk flash -b
159```
160
161## `qmk config`
162
163This 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```
168qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN]
169```
170
171## `qmk docs`
172
173This 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```
178qmk docs [-p PORT]
179```
180
181## `qmk doctor`
182
183This 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```
188qmk doctor [-y] [-n]
189```
190
191**Examples**:
192
193Check your environment for problems and prompt to fix them:
194
195 qmk doctor
196
197Check your environment and automatically fix any problems found:
198
199 qmk doctor -y
200
201Check your environment and report problems only:
202
203 qmk doctor -n
204
205## `qmk json-keymap`
206
207Creates a keymap.c from a QMK Configurator export.
208
209**Usage**:
210
211```
212qmk json-keymap [-o OUTPUT] filename
213```
214
215## `qmk kle2json`
216
217This 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```
222qmk 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
239This command lists all the keyboards currently defined in `qmk_firmware`
240
241**Usage**:
242
243```
244qmk list-keyboards
245```
246
247## `qmk list-keymaps`
248
249This command lists all the keymaps for a specified keyboard (and revision).
250
251**Usage**:
252
253```
254qmk list-keymaps -kb planck/ez
255```
256
257## `qmk new-keymap`
258
259This command creates a new keymap based on a keyboard's existing default keymap.
260
261**Usage**:
262
263```
264qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
265```
266
267## `qmk pyformat`
268
269*dev mode*
270
271This command formats python code in `qmk_firmware`.
272
273**Usage**:
274
275```
276qmk pyformat
277```
278
279## `qmk pytest`
280
281*dev mode*
282
283This command runs the python test suite. If you make changes to python code you should ensure this runs successfully.
284
285**Usage**:
286
287```
288qmk pytest
289```