Skip to content

Commit fdcea06

Browse files
authored
CLI/Docs: Fix the format commands' name (#13668)
PR #13296 changed the name of the `cformat` and `pyformat` commands to `format-c` and `format-py` respectively. This PR updates the documentation and some parts of the CLI to use the new names. Also add documentation for the new `format-text` subcommand, introduced in the same PR.
1 parent 164a74a commit fdcea06

File tree

9 files changed

+50
-39
lines changed

9 files changed

+50
-39
lines changed

.github/workflows/format.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ jobs:
3131
output: ' '
3232
fileOutput: ' '
3333

34-
- name: Run qmk cformat and qmk pyformat
34+
- name: Run qmk format-c and qmk format-python
3535
shell: 'bash {0}'
3636
run: |
37-
qmk cformat --core-only -n $(< ~/files.txt)
38-
cformat_exit=$?
39-
qmk pyformat -n
40-
pyformat_exit=$?
37+
qmk format-c --core-only -n $(< ~/files.txt)
38+
format_c_exit=$?
39+
qmk format-python -n
40+
format_python_exit=$?
4141
42-
exit $((cformat_exit + pyformat_exit))
42+
exit $((format_c_exit + format_python_exit))

docs/cli_commands.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,18 @@ qmk clean [-a]
314314

315315
# Developer Commands
316316

317-
## `qmk cformat`
317+
## `qmk format-text`
318+
319+
This command formats text files to have proper line endings.
320+
321+
Every text file in the repository needs to have Unix (LF) line ending.
322+
If you are working on **Windows**, you must ensure that line endings are corrected in order to get your PRs merged.
323+
324+
```
325+
qmk format-text
326+
```
327+
328+
## `qmk format-c`
318329

319330
This command formats C code using clang-format.
320331

@@ -325,25 +336,25 @@ Run it with `-a` to format all core code, or pass filenames on the command line
325336
**Usage for specified files**:
326337

327338
```
328-
qmk cformat [file1] [file2] [...] [fileN]
339+
qmk format-c [file1] [file2] [...] [fileN]
329340
```
330341

331342
**Usage for all core files**:
332343

333344
```
334-
qmk cformat -a
345+
qmk format-c -a
335346
```
336347

337348
**Usage for only changed files against origin/master**:
338349

339350
```
340-
qmk cformat
351+
qmk format-c
341352
```
342353

343354
**Usage for only changed files against branch_name**:
344355

345356
```
346-
qmk cformat -b branch_name
357+
qmk format-c -b branch_name
347358
```
348359

349360
## `qmk docs`
@@ -398,14 +409,14 @@ $ qmk kle2json -f kle.txt -f
398409
Ψ Wrote out to info.json
399410
```
400411

401-
## `qmk pyformat`
412+
## `qmk format-python`
402413

403414
This command formats python code in `qmk_firmware`.
404415

405416
**Usage**:
406417

407418
```
408-
qmk pyformat
419+
qmk format-python
409420
```
410421

411422
## `qmk pytest`

docs/cli_development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ cli.log.info('Reading from %s and writing to %s', cli.args.filename, cli.args.ou
188188

189189
# Testing, and Linting, and Formatting (oh my!)
190190

191-
We use nose2, flake8, and yapf to test, lint, and format code. You can use the `pytest` and `pyformat` subcommands to run these tests:
191+
We use nose2, flake8, and yapf to test, lint, and format code. You can use the `pytest` and `format-py` subcommands to run these tests:
192192

193193
### Testing and Linting
194194

195195
qmk pytest
196196

197197
### Formatting
198198

199-
qmk pyformat
199+
qmk format-py
200200

201201
## Formatting Details
202202

docs/de/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,14 @@ qmk compile <configuratorExport.json>
8888
qmk compile -kb <keyboard_name> -km <keymap_name>
8989
```
9090

91-
## `qmk cformat`
91+
## `qmk format-c`
9292

9393
Dieser Befehl formatiert C-Code im clang-Format. Benutze ihn ohne Argumente, um den core-Code zu formatieren, oder benutze Namen von Dateien in der CLI, um den Befehl auf bestimmte Dateien anzuwenden.
9494

9595
**Anwendung**:
9696

9797
```
98-
qmk cformat [file1] [file2] [...] [fileN]
98+
qmk format-c [file1] [file2] [...] [fileN]
9999
```
100100

101101
## `qmk config`
@@ -148,14 +148,14 @@ Dieser Befehl erstellt eine neue Keymap basierend auf einer existierenden Standa
148148
qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
149149
```
150150

151-
## `qmk pyformat`
151+
## `qmk format-py`
152152

153153
Dieser Befehl formatiert Python-Code in `qmk_firmware`.
154154

155155
**Anwendung**:
156156

157157
```
158-
qmk pyformat
158+
qmk format-py
159159
```
160160

161161
## `qmk pytest`

docs/fr-fr/cli.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ qmk compile <configuratorExport.json>
8585
qmk compile -kb <keyboard_name> -km <keymap_name>
8686
```
8787

88-
## `qmk cformat`
88+
## `qmk format-c`
8989

9090
Cette commande formatte le code C en utilisant clang-format. Lancez-la sans arguments pour formatter tout le code core, ou passez les noms de fichiers à la ligne de commande pour la lancer sur des fichiers spécifiques.
9191

9292
**Utilisation**:
9393

9494
```
95-
qmk cformat [file1] [file2] [...] [fileN]
95+
qmk format-c [file1] [file2] [...] [fileN]
9696
```
9797

9898
## `qmk config`
@@ -125,14 +125,14 @@ Cette commande crée une nouvelle keymap basée sur une keymap par défaut d'un
125125
qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
126126
```
127127

128-
## `qmk pyformat`
128+
## `qmk format-py`
129129

130130
Cette commande formate le code python dans `qmk_firmware`.
131131

132132
**Utilisation**:
133133

134134
```
135-
qmk pyformat
135+
qmk format-py
136136
```
137137

138138
## `qmk pytest`

docs/ja/cli_commands.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
211211

212212
# 開発者用コマンド
213213

214-
## `qmk cformat`
214+
## `qmk format-c`
215215

216216
このコマンドは clang-format を使って C コードを整形します。
217217

@@ -222,25 +222,25 @@ qmk new-keymap [-kb KEYBOARD] [-km KEYMAP]
222222
**指定したファイルに対する使い方**:
223223

224224
```
225-
qmk cformat [file1] [file2] [...] [fileN]
225+
qmk format-c [file1] [file2] [...] [fileN]
226226
```
227227

228228
**全てのコアファイルに対する使い方**:
229229

230230
```
231-
qmk cformat -a
231+
qmk format-c -a
232232
```
233233

234234
**origin/master で変更されたファイルのみに対する使い方**:
235235

236236
```
237-
qmk cformat
237+
qmk format-c
238238
```
239239

240240
**branch_name で変更されたファイルのみに対する使い方**:
241241

242242
```
243-
qmk cformat -b branch_name
243+
qmk format-c -b branch_name
244244
```
245245

246246
## `qmk docs`
@@ -275,14 +275,14 @@ $ qmk kle2json -f kle.txt -f
275275
Ψ Wrote out to info.json
276276
```
277277

278-
## `qmk pyformat`
278+
## `qmk format-py`
279279

280280
このコマンドは `qmk_firmware` 内の python コードを整形します。
281281

282282
**使用法**:
283283

284284
```
285-
qmk pyformat
285+
qmk format-py
286286
```
287287

288288
## `qmk pytest`

docs/ja/cli_development.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,15 +192,15 @@ cli.log.info('Reading from %s and writing to %s', cli.args.filename, cli.args.ou
192192

193193
# テスト、リントおよびフォーマット
194194

195-
nose2、flake8 および yapf を使ってコードをテスト、リントおよびフォーマットします。これらのテストを実行するために `pytest``pyformat` サブコマンドを使うことができます。
195+
nose2、flake8 および yapf を使ってコードをテスト、リントおよびフォーマットします。これらのテストを実行するために `pytest``format-py` サブコマンドを使うことができます。
196196

197197
### テストとリント
198198

199199
qmk pytest
200200

201201
### フォーマット
202202

203-
qmk pyformat
203+
qmk format-py
204204

205205
## フォーマットの詳細
206206

lib/python/qmk/cli/format/c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def format_c(cli):
127127

128128
# Sanity check
129129
if not files:
130-
cli.log.error('No changed files detected. Use "qmk cformat -a" to format all core files')
130+
cli.log.error('No changed files detected. Use "qmk format-c -a" to format all core files')
131131
return False
132132

133133
# Run clang-format on the files we've found

lib/python/qmk/tests/test_cli_commands.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ def check_returncode(result, expected=[0]):
3131
assert result.returncode in expected
3232

3333

34-
def test_cformat():
35-
result = check_subcommand('cformat', '-n', 'quantum/matrix.c')
34+
def test_format_c():
35+
result = check_subcommand('format-c', '-n', 'quantum/matrix.c')
3636
check_returncode(result)
3737

3838

39-
def test_cformat_all():
40-
result = check_subcommand('cformat', '-n', '-a')
39+
def test_format_c_all():
40+
result = check_subcommand('format-c', '-n', '-a')
4141
check_returncode(result, [0, 1])
4242

4343

@@ -80,8 +80,8 @@ def test_hello():
8080
assert 'Hello,' in result.stdout
8181

8282

83-
def test_pyformat():
84-
result = check_subcommand('pyformat', '--dry-run')
83+
def test_format_python():
84+
result = check_subcommand('format-python', '--dry-run')
8585
check_returncode(result)
8686
assert 'Python code in `bin/qmk` and `lib/python` is correctly formatted.' in result.stdout
8787

0 commit comments

Comments
 (0)