aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErovia <erovia@users.noreply.github.com>2020-03-22 19:48:30 +0100
committerskullydazed <skullydazed@users.noreply.github.com>2020-04-08 09:31:14 -0700
commit5cfc3ce02e3c8007ac42e8089ecc895771bb3bfb (patch)
treecd57c376585c927e353190a785810b68ad9f9594
parent724f20ed32758b0c5d91ad4b7ba4a9348e152eeb (diff)
downloadqmk_firmware-5cfc3ce02e3c8007ac42e8089ecc895771bb3bfb.tar.gz
qmk_firmware-5cfc3ce02e3c8007ac42e8089ecc895771bb3bfb.zip
Rebase on master, hide some other subcommands
The list of hidden subcommands were approved by @skullydazed ;) Currently hidden if 'user.developer' is not True: - cformat - docs - kle2json - pyformat - pytest
-rwxr-xr-xbin/qmk2
-rw-r--r--docs/cli.md250
-rw-r--r--docs/cli_commands.md10
-rw-r--r--docs/cli_development.md12
-rw-r--r--lib/python/qmk/cli/cformat.py2
-rw-r--r--lib/python/qmk/cli/docs.py2
-rwxr-xr-xlib/python/qmk/cli/kle2json.py2
7 files changed, 25 insertions, 255 deletions
diff --git a/bin/qmk b/bin/qmk
index b83f111e5..8225ba61c 100755
--- a/bin/qmk
+++ b/bin/qmk
@@ -24,7 +24,7 @@ def _check_modules(requirements):
24 for line in fd.readlines(): 24 for line in fd.readlines():
25 line = line.strip().replace('<', '=').replace('>', '=') 25 line = line.strip().replace('<', '=').replace('>', '=')
26 26
27 if len(line) == 0 or line[0] == '#' or '-r' in line: 27 if len(line) == 0 or line[0] == '#' or line.startswith('-r'):
28 continue 28 continue
29 29
30 if '#' in line: 30 if '#' in line:
diff --git a/docs/cli.md b/docs/cli.md
index 625ac4fb7..760fe1cdb 100644
--- a/docs/cli.md
+++ b/docs/cli.md
@@ -37,253 +37,3 @@ 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```
diff --git a/docs/cli_commands.md b/docs/cli_commands.md
index eb5362bd2..570f841bc 100644
--- a/docs/cli_commands.md
+++ b/docs/cli_commands.md
@@ -4,6 +4,8 @@
4 4
5## `qmk cformat` 5## `qmk cformat`
6 6
7*(dev mode)*
8
7This command formats C code using clang-format. 9This command formats C code using clang-format.
8 10
9Run 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>` 11Run 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>`
@@ -138,6 +140,8 @@ qmk config [-ro] [config_token1] [config_token2] [...] [config_tokenN]
138 140
139## `qmk docs` 141## `qmk docs`
140 142
143*(dev mode)*
144
141This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936. 145This command starts a local HTTP server which you can use for browsing or improving the docs. Default port is 8936.
142 146
143**Usage**: 147**Usage**:
@@ -182,6 +186,8 @@ qmk json2c [-o OUTPUT] filename
182 186
183## `qmk kle2json` 187## `qmk kle2json`
184 188
189*(dev mode)*
190
185This 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. 191This 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.
186 192
187**Usage**: 193**Usage**:
@@ -234,6 +240,8 @@ qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
234 240
235## `qmk pyformat` 241## `qmk pyformat`
236 242
243*(dev mode)*
244
237This command formats python code in `qmk_firmware`. 245This command formats python code in `qmk_firmware`.
238 246
239**Usage**: 247**Usage**:
@@ -244,6 +252,8 @@ qmk pyformat
244 252
245## `qmk pytest` 253## `qmk pytest`
246 254
255*(dev mode)*
256
247This command runs the python test suite. If you make changes to python code you should ensure this runs successfully. 257This command runs the python test suite. If you make changes to python code you should ensure this runs successfully.
248 258
249**Usage**: 259**Usage**:
diff --git a/docs/cli_development.md b/docs/cli_development.md
index e41afc42f..2a967de4a 100644
--- a/docs/cli_development.md
+++ b/docs/cli_development.md
@@ -6,7 +6,17 @@ This document has useful information for developers wishing to write new `qmk` s
6 6
7The QMK CLI operates using the subcommand pattern made famous by git. The main `qmk` script is simply there to setup the environment and pick the correct entrypoint to run. Each subcommand is a self-contained module with an entrypoint (decorated by `@cli.subcommand()`) that performs some action and returns a shell returncode, or None. 7The QMK CLI operates using the subcommand pattern made famous by git. The main `qmk` script is simply there to setup the environment and pick the correct entrypoint to run. Each subcommand is a self-contained module with an entrypoint (decorated by `@cli.subcommand()`) that performs some action and returns a shell returncode, or None.
8 8
9*Tip*: Enable dev mode by `qmk config user.developer=True` 9## Developer mode:
10
11If you intend to maintain keyboards and/or contribute to QMK, you can enable the CLI's "Developer" mode:
12
13`qmk config user.developer=True`
14
15This will allow you to see all available subcommands.
16**Note:** You will have to install additional requirements:
17```bash
18python3 -m pip install -r requirements-dev.txt
19```
10 20
11# Subcommands 21# Subcommands
12 22
diff --git a/lib/python/qmk/cli/cformat.py b/lib/python/qmk/cli/cformat.py
index 7e3a91dcf..48f8b9bcc 100644
--- a/lib/python/qmk/cli/cformat.py
+++ b/lib/python/qmk/cli/cformat.py
@@ -35,7 +35,7 @@ def cformat_run(files, all_files):
35@cli.argument('-a', '--all-files', arg_only=True, action='store_true', help='Format all core files.') 35@cli.argument('-a', '--all-files', arg_only=True, action='store_true', help='Format all core files.')
36@cli.argument('-b', '--base-branch', default='origin/master', help='Branch to compare to diffs to.') 36@cli.argument('-b', '--base-branch', default='origin/master', help='Branch to compare to diffs to.')
37@cli.argument('files', nargs='*', arg_only=True, help='Filename(s) to format.') 37@cli.argument('files', nargs='*', arg_only=True, help='Filename(s) to format.')
38@cli.subcommand("Format C code according to QMK's style.") 38@cli.subcommand("Format C code according to QMK's style.", hidden=True)
39def cformat(cli): 39def cformat(cli):
40 """Format C code according to QMK's style. 40 """Format C code according to QMK's style.
41 """ 41 """
diff --git a/lib/python/qmk/cli/docs.py b/lib/python/qmk/cli/docs.py
index 163c8b801..1d655ecaa 100644
--- a/lib/python/qmk/cli/docs.py
+++ b/lib/python/qmk/cli/docs.py
@@ -7,7 +7,7 @@ from milc import cli
7 7
8 8
9@cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.') 9@cli.argument('-p', '--port', default=8936, type=int, help='Port number to use.')
10@cli.subcommand('Run a local webserver for QMK documentation.') 10@cli.subcommand('Run a local webserver for QMK documentation.', hidden=True)
11def docs(cli): 11def docs(cli):
12 """Spin up a local HTTPServer instance for the QMK docs. 12 """Spin up a local HTTPServer instance for the QMK docs.
13 """ 13 """
diff --git a/lib/python/qmk/cli/kle2json.py b/lib/python/qmk/cli/kle2json.py
index 00f63d362..4e74e75a3 100755
--- a/lib/python/qmk/cli/kle2json.py
+++ b/lib/python/qmk/cli/kle2json.py
@@ -26,7 +26,7 @@ class CustomJSONEncoder(json.JSONEncoder):
26 26
27@cli.argument('filename', help='The KLE raw txt to convert') 27@cli.argument('filename', help='The KLE raw txt to convert')
28@cli.argument('-f', '--force', action='store_true', help='Flag to overwrite current info.json') 28@cli.argument('-f', '--force', action='store_true', help='Flag to overwrite current info.json')
29@cli.subcommand('Convert a KLE layout to a Configurator JSON') 29@cli.subcommand('Convert a KLE layout to a Configurator JSON', hidden=True)
30def kle2json(cli): 30def kle2json(cli):
31 """Convert a KLE layout to QMK's layout format. 31 """Convert a KLE layout to QMK's layout format.
32 """ # If filename is a path 32 """ # If filename is a path