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

Convert new_keyboard.sh to a python command #6872

Closed
1 of 4 tasks
skullydazed opened this issue Oct 2, 2019 · 14 comments · Fixed by #12795
Closed
1 of 4 tasks

Convert new_keyboard.sh to a python command #6872

skullydazed opened this issue Oct 2, 2019 · 14 comments · Fixed by #12795
Labels
cli qmk cli command good first issue hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted in progress python

Comments

@skullydazed
Copy link
Member

Feature Request Type

  • Core functionality
  • Add-on hardware support (eg. audio, RGB, OLED screen, etc.)
  • Alteration (enhancement/optimization) of existing feature(s)
  • New behavior

Description

Similar to #6066, we should convert new_keyboard.sh to a qmk command.

Some thoughts on implementation:

  • The cleanest way to handle the templates is probably by using .format() string formatting.
  • Like new_keymap the user should be able to supply answers on the command line. Any information not provided should be prompted for.
  • This is an instance where most (all?) CLI flags should be arg_only=True.
@skullydazed skullydazed added hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted good first issue python cli qmk cli command labels Oct 2, 2019
@HBBisenieks
Copy link
Contributor

Is the intention that this be, essentially, a drop-in replacement for the current .sh version with the addition of CLI flags that supersede the interactive prompts?

@skullydazed
Copy link
Member Author

As a start, yes. I think there will be room to iterate and improve on it once that is done, and I'd welcome most of those improvements as part of the initial PR. For example, support for arm keyboards.

@HBBisenieks
Copy link
Contributor

HBBisenieks commented Oct 3, 2019

I'm making a branch on my fork to get the ball rolling on this, and I'll open a PR when it's at least feature-complete with the .sh version. LOL @stjohnjohnson beat me to it.

@stjohnjohnson
Copy link
Contributor

@HBBisenieks sorry!

@HBBisenieks
Copy link
Contributor

Hey no worries! Your implementation looks way better than mine was looking in the planning stages.

@thiagoyeds
Copy link

Hi @skullydazed, what is the advantage of replacing .sh with a python command? Better debugging?

@lf-
Copy link
Contributor

lf- commented Oct 7, 2019

@ThiagoWhispher I'm going to go for maintainability, consistency in output/behaviour, reliability, and moving all the shell stuff to the qmk utility.

@stjohnjohnson
Copy link
Contributor

I like the idea of centralizing all these commands into a single CLI. Combine that with the Docker container and you have a single command with no dependencies (besides Docker) for all operations.

@thiagoyeds
Copy link

@lf- now I understand how advantageous this is.
@stjohnjohnson I working with Docker, and strongly recommend, very practical to work.

@helios1101
Copy link

Are these docker images hosted on Docker Hub too? Just wanted to start my journey in containers as it would be my first experience with dockers contribution.

@stjohnjohnson
Copy link
Contributor

@qmk qmk deleted a comment from sakshamtaneja21 Oct 26, 2019
@ShiftyBlock

This comment has been minimized.

@ShiftyBlock

This comment has been minimized.

stjohnjohnson added a commit to stjohnjohnson/qmk_firmware that referenced this issue Nov 20, 2019
Per request in qmk#6872, this adds a new CLI command `qmk new_keyboard`
that mirrors the existing functionality in `util/new_keyboard.sh`.

 - Accepts keyboard, type, and username from arg or input
 - Validates type against `avr` and `ps2avrgb`
 - Copies base and $type into new directory
 - Replaces %YEAR%, %KEYBOARD%, and %YOUR_NAME% across specific files

Note, had to use `distutils.dir_util.copy_tree` instead of
`shutil.copytree` as the `shutil` version does not support copying into
an existing folder.
@stale
Copy link

stale bot commented Jan 27, 2020

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.

@stale stale bot added the stale Issues or pull requests that have become inactive without resolution. label Jan 27, 2020
@skullydazed skullydazed added in progress and removed stale Issues or pull requests that have become inactive without resolution. labels Jan 27, 2020
@tzarc tzarc closed this as completed Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli qmk cli command good first issue hacktoberfest-accepted All the good issues to tackle during Hacktoberfest! help wanted in progress python
Projects
None yet
8 participants