From 0d936b2fe6a2518f2562c59f7f84692590d77aa0 Mon Sep 17 00:00:00 2001 From: fauxpark Date: Wed, 27 Feb 2019 02:59:34 +1100 Subject: [PATCH] Ask for your name when generating a new keyboard (#5214) * Ask for your name when generating a new keyboard * Update docs * Apply suggestions from code review Co-Authored-By: fauxpark --- docs/contributing.md | 4 ++-- quantum/template/avr/config.h | 4 ++-- quantum/template/avr/readme.md | 2 +- quantum/template/avr/template.c | 2 +- quantum/template/base/keymaps/default/config.h | 2 +- quantum/template/base/keymaps/default/keymap.c | 2 +- quantum/template/base/template.h | 2 +- quantum/template/ps2avrgb/template.c | 2 +- util/new_project.sh | 8 ++++++-- 9 files changed, 16 insertions(+), 12 deletions(-) diff --git a/docs/contributing.md b/docs/contributing.md index eee40609bb..88b9d7d9b4 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -137,7 +137,7 @@ Most first-time QMK contributors start with their personal keymaps. We try to ke * All Keymap PR's are squashed, so if you care about how your commits are squashed you should do it yourself * Do not lump features in with keymap PR's. Submit the feature first and then a second PR for the keymap. * Do not include `Makefile`s in your keymap folder (they're no longer used) -* Update copyrights in file headers (look for `REPLACE_WITH_YOUR_NAME `) +* Update copyrights in file headers (look for `%YOUR_NAME%`) ## Keyboards @@ -150,7 +150,7 @@ We also ask that you follow these guidelines: * Do not lump core features in with new keyboards. Submit the feature first and then submit a separate PR for the keyboard. * Name `.c`/`.h` file after the immediate parent folder, eg `/keyboards///.[ch]` * Do not include `Makefile`s in your keyboard folder (they're no longer used) -* Update copyrights in file headers (look for `REPLACE_WITH_YOUR_NAME `) +* Update copyrights in file headers (look for `%YOUR_NAME%`) ## Quantum/TMK Core diff --git a/quantum/template/avr/config.h b/quantum/template/avr/config.h index 2409ae186c..a9bb754821 100644 --- a/quantum/template/avr/config.h +++ b/quantum/template/avr/config.h @@ -1,5 +1,5 @@ /* -Copyright 2019 REPLACE_WITH_YOUR_NAME +Copyright 2019 %YOUR_NAME% This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -23,7 +23,7 @@ along with this program. If not, see . #define VENDOR_ID 0xFEED #define PRODUCT_ID 0x0000 #define DEVICE_VER 0x0001 -#define MANUFACTURER You +#define MANUFACTURER %YOUR_NAME% #define PRODUCT %KEYBOARD% #define DESCRIPTION A custom keyboard diff --git a/quantum/template/avr/readme.md b/quantum/template/avr/readme.md index d243c66a94..719222d377 100644 --- a/quantum/template/avr/readme.md +++ b/quantum/template/avr/readme.md @@ -4,7 +4,7 @@ A short description of the keyboard/project -Keyboard Maintainer: [You](https://github.com/yourusername) +Keyboard Maintainer: [%YOUR_NAME%](https://github.com/yourusername) Hardware Supported: The PCBs, controllers supported Hardware Availability: links to where you can find this hardware diff --git a/quantum/template/avr/template.c b/quantum/template/avr/template.c index 3deeae88ba..1e4ce26cd1 100644 --- a/quantum/template/avr/template.c +++ b/quantum/template/avr/template.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/keymaps/default/config.h b/quantum/template/base/keymaps/default/config.h index c8e4334124..44382016a1 100644 --- a/quantum/template/base/keymaps/default/config.h +++ b/quantum/template/base/keymaps/default/config.h @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/keymaps/default/keymap.c b/quantum/template/base/keymaps/default/keymap.c index 11cd134a06..482a445448 100644 --- a/quantum/template/base/keymaps/default/keymap.c +++ b/quantum/template/base/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/base/template.h b/quantum/template/base/template.h index caf2abb4c6..5b5076c476 100644 --- a/quantum/template/base/template.h +++ b/quantum/template/base/template.h @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/quantum/template/ps2avrgb/template.c b/quantum/template/ps2avrgb/template.c index 4e35a2c129..08156c562c 100644 --- a/quantum/template/ps2avrgb/template.c +++ b/quantum/template/ps2avrgb/template.c @@ -1,4 +1,4 @@ -/* Copyright 2019 REPLACE_WITH_YOUR_NAME +/* Copyright 2019 %YOUR_NAME% * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/util/new_project.sh b/util/new_project.sh index d1d1ed82ca..9dec714b02 100755 --- a/util/new_project.sh +++ b/util/new_project.sh @@ -43,7 +43,11 @@ GIT=$(whereis git) if [ "$GIT" != "" ]; then IS_GIT_REPO=$($GIT log >>/dev/null 2>&1; echo $?) if [ "$IS_GIT_REPO" -eq 0 ]; then - ID="'$($GIT config --get user.name)'" + ID="$($GIT config --get user.name)" + read -rp "What is your name? [$ID] " YOUR_NAME + if [ -n "$YOUR_NAME" ]; then + ID=$YOUR_NAME + fi echo "Using $ID as user name" for i in "$NEW_KBD/config.h" \ @@ -52,7 +56,7 @@ if [ "$GIT" != "" ]; then "$NEW_KBD/keymaps/default/config.h" \ "$NEW_KBD/keymaps/default/keymap.c" do - awk -v id="$ID" '{sub(/REPLACE_WITH_YOUR_NAME/,id); print}' < "$i" > "$i.$$" + awk -v id="$ID" '{sub(/%YOUR_NAME%/,id); print}' < "$i" > "$i.$$" mv "$i.$$" "$i" done fi