1
0
Fork 0

Improve argument handling of c2json (#22170)

* Improve argument handling of c2json

* Add automagic
This commit is contained in:
Joel Challis 2023-11-01 22:37:05 +00:00 committed by GitHub
parent a27bc60703
commit 8ea955c72f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 42 deletions

View file

@ -19,13 +19,11 @@ def is_keyboard(keyboard_name):
return rules_mk.exists()
def under_qmk_firmware():
def under_qmk_firmware(path=Path(os.environ['ORIG_CWD'])):
"""Returns a Path object representing the relative path under qmk_firmware, or None.
"""
cwd = Path(os.environ['ORIG_CWD'])
try:
return cwd.relative_to(QMK_FIRMWARE)
return path.relative_to(QMK_FIRMWARE)
except ValueError:
return None