Commit graph

42 commits

Author SHA1 Message Date
Ryan
25f43837d2
Remove references to info.json width and height in CLI (#13728) 2021-07-29 22:37:18 -07:00
Erovia
fdcea06336
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.
2021-07-23 21:41:33 +01:00
Ryan
bbe43a91eb
CLI: Add subcommand to generate version.h (#13151) 2021-06-27 02:29:02 +10:00
Zach White
6955c5a002 Merge remote-tracking branch 'origin/master' into develop
Resolved Conflicts:
	lib/python/qmk/tests/test_cli_commands.py
	util/install/fedora.sh
2021-05-19 15:49:11 -07:00
Zach White
db1eacdaac
Align our subprocess usage with current best practices. (#12940)
* Align our subprocess usage with current best practices.

* remove unused import

* Apply suggestions from code review

Co-authored-by: Ryan <fauxpark@gmail.com>

* fix the cpp invocation for older python

* allow for unprompted installation

* make sure qmk new-keyboard works on windows

Co-authored-by: Ryan <fauxpark@gmail.com>
2021-05-19 15:24:46 -07:00
Zach White
de5c30a9ba
Use milc.subcommand.config instead of qmk.cli.config (#12915)
* Use milc.subcommand.config instead

* pyformat

* remove the config test
2021-05-16 11:06:57 -07:00
QMK Bot
911b45ce3b Merge remote-tracking branch 'origin/master' into develop 2021-05-10 18:19:15 +00:00
Zach White
a3e7f3e7c5
Improve our CI tests (#11476)
* add a test and dry-run to qmk generate-api

* add a dry-run to qmk pyformat

* Add a --dry-run to qmk cformat

* reverse the order of nose2 and flake8 tests

* run CI test against cformat and pyformat

* fix programming errors

* tweak job name

* fix argument

* refine the files we select

* fix stack trace in --ci

* make cformat exit clean

* fix c file extensions

* decouple CI from pyformat

* remove --ci arg

* make ci happy

* use the environment var instead

* change output to text

* fix log message

* replace tabs
2021-05-10 11:18:44 -07:00
QMK Bot
a747ef966b Merge remote-tracking branch 'origin/master' into develop 2021-03-25 11:38:44 +00:00
Zach White
3e60997edb
Add a qmk format-json command that will format JSON files (#12372)
* Add a command to format json files

* change to work after rebase

* add test for qmk format-json

* add documentation for qmk format-json

* Update lib/python/qmk/cli/format/json.py
2021-03-25 22:38:10 +11:00
QMK Bot
0dc0516f0c Merge remote-tracking branch 'origin/master' into develop 2021-03-24 16:27:28 +00:00
Zach White
299008be36
Add support for qmk_configurator style aliases (#11954)
* Add support for qmk_configurator style aliases

* add the keyboard aliases to the api data

* add support for a keyboard metadata file

* make flake8 happy
2021-03-24 09:26:38 -07:00
Zach White
b0069c5c05
Begin the process of deprecating bin/qmk in favor of the global cli (#12109)
* Begin the process of deprecating bin/qmk in favor of the global cli

* Correctly set the qmk bin
2021-03-07 19:10:03 -08:00
Zach White
1581ea48dc
Fix develop (#12039)
Fixes file encoding errors on Windows, and layouts not correctly merging into info.json.

* force utf8 encoding

* correctly merge layouts and layout aliases

* show what aliases point to
2021-02-27 12:00:50 -08:00
Zach White
ef6329af7c
Create a system to map between info.json and config.h/rules.mk (#11548)
* generate rules.mk from a json mapping

* generate rules.mk from a json mapping

* support for config.h from json maps

* improve the mapping system

* document the mapping system

* move data/maps to data/mappings

* fix flake8 errors

* fixup LED_MATRIX_DRIVER

* remove product and description from the vision_division keymap level

* reduce the complexity of generate-rules-mk

* add tests for the generate commands

* fix qmk doctor when submodules are not clean
2021-01-31 12:46:00 -08:00
Joel Challis
f03b10b6c1
Migrate python tests away from onekey (#11367)
* Migrate python tests away from onekey

* Add stub files to stop lint complaints

* Make all the pytest keymaps compile
2021-01-05 00:52:31 +00:00
LongerHV
221d8fd866
[CLI] Add stdin support for json2c command (#11289)
* Implement stdin for json2c command

* Refactor

* Handle json decode error

* Add stdin support for c2json cli command

* Refactor to prevent code duplication

* Change exit(1) to return False in c2json command

* Remove unused import
2020-12-29 11:34:48 -08:00
Ryan
37fb14f1b5
CLI-ify rgblight_breathing_table_calc.c (#11174)
Co-authored-by: Takeshi ISHII <2170248+mtei@users.noreply.github.com>
Co-authored-by: Zach White <skullydazed@drpepper.org>
2020-12-16 14:24:42 +11:00
Zach White
8724a70c4c
Reduce travis load by replacing an exclusive grep with an inclusive grep (#10964)
* add -n to avoid compiling

* switch to an include rather than exclude strategy
2020-11-30 11:19:44 -08:00
Erovia
b337ba798e
CLI: Udev related fixes and improvements (#10736) 2020-11-16 21:09:32 +00:00
Ryan
7ef98e7f61
CLI: Add qmk clean (#10785) 2020-11-04 19:18:47 +00:00
Ryan
e69da2db2c
qmk info: Add --ascii flag (#10793)
* `qmk info`: Add `--ascii` flag

* Fix typo

* Force ASCII for Windows/MSYS2

* Make it gooder

* Remove redundant windows check

* ...And this too

* Make pytest work on Windows
2020-11-02 00:41:01 -08:00
Erovia
058737f116
[CLI] Add c2json (#8817)
* Basic keymap parsing finally works

* Add 'keymap.json' creation to the qmk.keymap module

* Add tests and fix formatting

* Fix/exclude flake8 errors

* Convert keymap.c to valid keymap.json

* Fix some errors

* Add tests

* Finalize keymap.json creation, add json template

* Add docs

* Move pygments to the standard requirements

* Add support for nameless layers, fix tests

* Fix things after rebase

* Add missing 'keymap' value.

* Fix missing layer numbers from advanced keycodes

Buckwich noticed that if the advanced keycode / layer toggling key
contains a number, it goes missing.
Now we properly handle them.
Thx for noticing!

* Apply suggestions from code review

* fixup tests

Co-authored-by: Zach White <skullydazed@drpepper.org>
Co-authored-by: skullY <skullydazed@gmail.com>
2020-10-06 17:10:19 -07:00
Ryan
2c9ffd4739
CLI: update subcommands to use return instead of exit() (#10323) 2020-10-06 16:46:10 -07:00
Ryan
db80209e69
Parse version better in qmk doctor GCC version checks (#9324) 2020-06-18 19:37:47 +01:00
Zach White
751316c344
[CLI] Add a subcommand for getting information about a keyboard (#8666)
You can now use `qmk info` to get information about keyboards and keymaps.

Co-authored-by: Erovia <Erovia@users.noreply.github.com>
2020-05-26 13:05:41 -07:00
Erovia
6501377070
CLI: fix json2c subcommand and add/fix tests (#9206)
Co-authored-by: Zach White <skullydazed@users.noreply.github.com>
2020-05-26 17:43:33 +02:00
codecoffeecode
f125406700
Adding unit tests for list-keymaps command (#7711)
Co-Authored-By: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-Authored-By: Erovia <Erovia@users.noreply.github.com>
2020-05-16 22:47:07 +02:00
Erovia
c89c084146
CLI: More MSYS2 fixes (#8577)
* CLI: More MSYS2 fixes

Now I can fully setup and work with qmk_firmware on an MSYS2
installation without any errors or exceptions.

* Apply suggestions from code review

Co-Authored-By: skullydazed <skullydazed@users.noreply.github.com>

* Some improvements

* Remove unnecessary import

* Remove slow, unused code

Getting the version from GIT was slow on both Windows and Docker.
Until we find a better, faster way, this is removed.

* remove unused imports

* Implement @vomindoraan's suggestions

* refine how we pick the shell to use

* Apply @fauxpark's suggestions

fauxpark investigated the topic of shells in MSYS2 a bit and we come to the conclusion that the safest bet was to just use the user's shell.
Anything more just opens up more edge-cases than it solves.

Co-Authored-By: Ryan <fauxpark@gmail.com>

* Use `platform_id` in doctor

This will bring it in line with the new code.

Co-authored-by: skullydazed <skullydazed@users.noreply.github.com>
Co-authored-by: skullY <skullydazed@gmail.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2020-03-29 14:29:44 +02:00
Akaash Suresh
b353028ea5
New functionality for cformat (#7893)
Fixing complexity

remove lambda

PR review fixes #1

Removing unneccesary string substitution

Handle -a and specified files

Complexity rewrite, use pathlib
2020-02-22 20:57:19 -08:00
Erovia
3db41817e0 Code cleanup, use pathlib, use pytest keyboard
Clean up checks and logics that are unnecessary due to MILC updates.
Use pathlib instead of os.path for readability.
Use the 'pytest' keyboard for the tests.
Add community layout for 'handwired/onekey/pytest' so we can test
community layouts.
2020-02-15 15:19:03 -08:00
Erovia
8eeab1112a Fix commandline parsing and flake8 findings, rebase
Fixed commandline and config parsing. Thx @xplusplus.
Rebased on master and fixed merge conflicts.
2020-02-15 15:19:03 -08:00
Erovia
f8002828ca Add test for list_keymaps 2020-02-15 15:19:03 -08:00
Joel Challis
75e7018f72 CI: Add workflow for CLI testing (#7357)
Create GitHub Actions cli test workflow and remove travis runs of 'qmk pytest'
2020-02-08 13:43:55 +01:00
QMK Bot
7891de7f6d format code according to conventions [skip ci] 2019-11-16 07:10:19 +00:00
jorgemanzo
897888db41 Add CLI command for flashing a keyboard
A new CLI subcommand was added, flash, which behaves very similar to the already present compile CLI comamnd, but with the added ability to target a bootloader. The command is used like so: qmk flash [-h] [-b] [-kb KEYBOARD] [-km KEYMAP] [-bl BOOTLOADER] [filename].

A -kb <keyboard> and -km <keymap> is expected, or a configurator export JSON filename. A bootloader can be specified using -bl <target>, and if left unspecified, the target is assumed to be :flash. -bl can be used to list the available bootloaders.

If -km <keymap> is provided, but no -kb <keyboard>, then a message is printed suggesting the user to run qmk list_keyboards.
2019-11-15 23:06:07 -08:00
QMK Bot
a4c2a9b083 format code according to conventions [skip ci] 2019-11-13 05:24:56 +00:00
Cody Bender
7329c2d02d Add cli convert subcommand, from raw KLE to JSON (#6898)
* Add initial pass at KLE convert

* Add cli log on convert

* Move kle2xy, add absolute filepath arg support

* Add overwrite flag, and context sensitive conversion

* Update docs/cli.md

* Fix converter.py typo

* Add convert unit test

* Rename to kle2qmk

* Rename subcommand

* Rename subcommand to kle2json

* Change tests to cover rename

* Rename in __init__.py

* Update CLI docs with new subcommand name

* Fix from suggestions in PR #6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
2019-11-12 20:55:41 -08:00
skullY
79edb7c594 Small CLI cleanups
* yapf changes
* Fix the cformat test
* Make the normpath test work when run from /
* `qmk config`: Mark `--read-only` as arg_only
2019-11-12 18:41:38 -08:00
Erovia
a5a31a5fc0 MILC: Use dashes instead of underscores for subcommands
The subcommand functions' name follows the Python convention of using
snake case, but looks odd on the command line.
Fix it by converting underscores to dashes, eg.: list_keyboards ->
list-keyboards.
2019-10-23 22:46:30 -07:00
Dan McClain
f04e58dad6 [CLI] Add qmk list_keyboards (#6927)
`list_keyboards` replicates the `make list-keyboards` by globbing for all paths
that include `rules.mk` and then removing the paths that include `keymaps`.

This basis of this cli command could be reused in the future as a util, but is
not done so here since this would be the only place that would use it currently

Resolves #6911
2019-10-07 11:32:30 -07:00
skullydazed
d569f08771
Configuration system for CLI (#6708)
* Rework how bin/qmk handles subcommands

* qmk config wip

* Code to show all configs

* Fully working `qmk config` command

* Mark some CLI arguments so they don't pollute the config file

* Fleshed out config support, nicer subcommand support

* sync with installable cli

* pyformat

* Add a test for subcommand_modules

* Documentation for the `qmk config` command

* split config_token on space so qmk config is more predictable

* Rework how subcommands are imported

* Document `arg_only`

* Document deleting from CLI

* Document how multiple operations work

* Add cli config to the doc index

* Add tests for the cli commands

* Make running the tests more reliable

* Be more selective about building all default keymaps

* Update new-keymap to fit the new subcommand style

* Add documentation about writing CLI scripts

* Document new-keyboard

* Update docs/cli_configuration.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/cli_development.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/cli_development.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Update docs/cli_development.md

Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com>

* Address yan's comments.

* Apply suggestions from code review

suggestions from @noahfrederick

Co-Authored-By: Noah Frederick <code@noahfrederick.com>

* Apply suggestions from code review

Co-Authored-By: Noah Frederick <code@noahfrederick.com>

* Remove pip3 from the test runner
2019-09-22 13:25:33 -07:00