Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli convert subcommand, from raw KLE to JSON #6898

Merged
merged 19 commits into from
Nov 13, 2019

Conversation

cfbender
Copy link
Contributor

@cfbender cfbender commented Oct 4, 2019

Description

Adds a convert subcommand to convert raw KLE data files to configurator JSON.

Types of Changes

  • Core
  • Bugfix
  • New feature
  • Enhancement/optimization
  • Keyboard (addition or update)
  • Keymap/layout/userspace (addition or update)
  • Documentation

Issues Fixed or Closed by This PR

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • I have tested the changes and verified that they work and don't break anything (as well as I can manage).

@skullydazed skullydazed requested a review from a team October 6, 2019 21:13
@noroadsleft
Copy link
Member

I get an error when I try to run this.

 noroadsleft  /d/GitHub/qmk_firmware/lib/python/qmk/tests (pr/6898)
$ qmk kle2qmk ./kle.txt
<class 'AttributeError'>
☒ 'KLE2xy' object has no attribute 'args'
Traceback (most recent call last):
  File "/d/GitHub/qmk_firmware/lib/python/milc.py", line 564, in __call__
    return self.__call__()
  File "/d/GitHub/qmk_firmware/lib/python/milc.py", line 569, in __call__
    return self._entrypoint(self)
  File "/d/GitHub/qmk_firmware/lib/python/qmk/cli/kle2qmk.py", line 76, in kle2qmk
    layout = json.dumps(kle2qmk(kle), separators=(', ', ':'), cls=CustomJSONEncoder)
  File "/d/GitHub/qmk_firmware/lib/python/qmk/cli/kle2qmk.py", line 33, in kle2qmk
    if cli.args.filename:
AttributeError: 'KLE2xy' object has no attribute 'args'

@cfbender
Copy link
Contributor Author

cfbender commented Oct 7, 2019

Great catch, @noroadsleft! I think it was because of two functions both being named kle2qmk (in the converter module and the subcommand name). I renamed it to kle2json, hopefully that is a suitable name @skullydazed!

@cfbender
Copy link
Contributor Author

cfbender commented Oct 7, 2019

Hmmm I just did a rebase since it was giving me a merge conflict on lib/python/qmk/cli/__init__.py with the new list command being added. Was that correct? Seems like it changed a lot about this PR

@noroadsleft
Copy link
Member

@cfbender It looks like you had two different branches with the same set of changes, and then merged one into the other.

Try running git reset --hard 54354250caa53574d82dc097081079722d80f83e locally and seeing if you get to a clean state from which you can pick this back up.

@cfbender
Copy link
Contributor Author

cfbender commented Oct 8, 2019

@noroadsleft that was weird, thanks for the help! Looks like it should be all set now.

docs/cli.md Outdated Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
docs/cli.md Outdated Show resolved Hide resolved
@cfbender
Copy link
Contributor Author

cfbender commented Oct 8, 2019

Good catch again @noroadsleft, thank you!

Copy link
Member

@noroadsleft noroadsleft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some capitalization fixes, because I'm case-sensitive. 😃

docs/cli.md Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/converter.py Outdated Show resolved Hide resolved
lib/python/qmk/converter.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
lib/python/qmk/cli/kle2json.py Outdated Show resolved Hide resolved
@cfbender
Copy link
Contributor Author

cfbender commented Oct 8, 2019

Thanks for the great suggestions @noroadsleft and @skullydazed! I have learned a lot. Hopefully those commits cover it!

Copy link
Member

@noroadsleft noroadsleft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

Copy link
Member

@drashna drashna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__attribute__((weak))

@skullydazed skullydazed merged commit 7329c2d into qmk:master Nov 13, 2019
@skullydazed
Copy link
Member

Thanks for your work here, and your patience on the review!

@cfbender
Copy link
Contributor Author

Awesome, thanks @skullydazed! Happy to help and hope to more in the future!

drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Nov 18, 2019
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
ripxorip pushed a commit to ripxorip/qmk_firmware that referenced this pull request Dec 3, 2019
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
drashna pushed a commit to zsa/qmk_firmware that referenced this pull request Dec 10, 2019
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
patrl pushed a commit to patrl/qmk_firmware that referenced this pull request Dec 29, 2019
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Jan 6, 2020
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
fdidron pushed a commit to zsa/qmk_firmware that referenced this pull request Jan 8, 2020
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
HokieGeek pushed a commit to HokieGeek/qmk_firmware that referenced this pull request Feb 21, 2020
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
BorisTestov pushed a commit to BorisTestov/qmk_firmware that referenced this pull request May 23, 2024
* 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 qmk#6898

* Help with cases of case sensitivity

* Update cli.md

* Use angle brackets to indicate required option

* Make the output text more accurate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI command to convert KLE to JSON
4 participants