close
The Wayback Machine - https://web.archive.org/web/20210905111033/https://github.com/qmk/qmk_firmware/issues/6872
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

Open
1 of 4 tasks
skullydazed opened this issue Oct 2, 2019 · 14 comments · May be fixed by #12795
Open
1 of 4 tasks

Convert new_keyboard.sh to a python command #6872

skullydazed opened this issue Oct 2, 2019 · 14 comments · May be fixed by #12795

Comments

@skullydazed
Copy link
Task lists! Give feedback
Member

@skullydazed skullydazed commented Oct 2, 2019

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.
@HBBisenieks
Copy link
Contributor

@HBBisenieks HBBisenieks commented Oct 2, 2019

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

@skullydazed skullydazed commented Oct 3, 2019

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.

stjohnjohnson added a commit to stjohnjohnson/qmk_firmware that referenced this issue Oct 3, 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.
stjohnjohnson added a commit to stjohnjohnson/qmk_firmware that referenced this issue Oct 3, 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.
stjohnjohnson added a commit to stjohnjohnson/qmk_firmware that referenced this issue Oct 3, 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.
@HBBisenieks
Copy link
Contributor

@HBBisenieks 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

@stjohnjohnson stjohnjohnson commented Oct 3, 2019

@HBBisenieks sorry!

@HBBisenieks
Copy link
Contributor

@HBBisenieks HBBisenieks commented Oct 3, 2019

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

@thiagoyeds
Copy link

@thiagoyeds thiagoyeds commented Oct 7, 2019

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

@lf-
Copy link
Contributor

@lf- 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

@stjohnjohnson stjohnjohnson commented Oct 7, 2019

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

@thiagoyeds thiagoyeds commented Oct 7, 2019

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

@helios1101
Copy link

@helios1101 helios1101 commented Oct 7, 2019

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

@stjohnjohnson stjohnjohnson commented Oct 8, 2019

stjohnjohnson added a commit to stjohnjohnson/qmk_firmware that referenced this issue Oct 8, 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.
@qmk qmk deleted a comment from sakshamtaneja21 Oct 26, 2019
@ShiftyBlock

This comment was marked as off-topic.

@ShiftyBlock

This comment has been hidden.

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 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 label Jan 27, 2020
@zvecr zvecr linked a pull request that will close this issue May 3, 2021
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

7 participants