]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Small CLI cleanups
authorskullY <skullydazed@gmail.com>
Wed, 13 Nov 2019 01:27:08 +0000 (17:27 -0800)
committerskullydazed <skullydazed@users.noreply.github.com>
Wed, 13 Nov 2019 02:41:38 +0000 (18:41 -0800)
* yapf changes
* Fix the cformat test
* Make the normpath test work when run from /
* `qmk config`: Mark `--read-only` as arg_only

lib/python/qmk/cli/config.py
lib/python/qmk/cli/list/keyboards.py
lib/python/qmk/errors.py
lib/python/qmk/tests/attrdict.py
lib/python/qmk/tests/test_cli_commands.py
lib/python/qmk/tests/test_qmk_path.py

index d6c774e65164aabe8317598116b8ef73c05c3a98..c4ee20cba5bd26e3cb2e4adeb50314a08ac0cb28 100644 (file)
@@ -12,7 +12,7 @@ def print_config(section, key):
     cli.echo('%s.%s{fg_cyan}={fg_reset}%s', section, key, cli.config[section][key])
 
 
-@cli.argument('-ro', '--read-only', action='store_true', help='Operate in read-only mode.')
+@cli.argument('-ro', '--read-only', arg_only=True, action='store_true', help='Operate in read-only mode.')
 @cli.argument('configs', nargs='*', arg_only=True, help='Configuration options to read or write.')
 @cli.subcommand("Read and write configuration settings.")
 def config(cli):
index 53a7af75c668f65ecc22eece0f7cd0ca3afcedbe..2a29ccb146a798053d3c43fc1bf349a870eba62f 100644 (file)
@@ -6,6 +6,7 @@ import glob
 
 from milc import cli
 
+
 @cli.subcommand("List the keyboards currently defined within QMK")
 def list_keyboards(cli):
     """List the keyboards currently defined within QMK
index f9bf5b9af9e1ae270df9d5f5a8c2befe45f9d639..4a8a91556b80878786a416394cfaf4b15df674f2 100644 (file)
@@ -1,6 +1,5 @@
 class NoSuchKeyboardError(Exception):
     """Raised when we can't find a keyboard/keymap directory.
     """
-
     def __init__(self, message):
         self.message = message
index 391c75c4e1c8af57de6395fde4cdafb3a5bb4104..a2584b923337be0f9455e70ab0cf9d731abb6f17 100644 (file)
@@ -3,7 +3,6 @@ class AttrDict(dict):
 
     This should only be used to mock objects for unit testing. Please do not use this outside of qmk.tests.
     """
-
     def __init__(self, *args, **kwargs):
         super(AttrDict, self).__init__(*args, **kwargs)
         self.__dict__ = self
index 9a9dc4b958af1831a5bce10df56c9174752c127f..55b8d253f7ffb2ad35946cc2617b4677f6c0a12e 100644 (file)
@@ -7,7 +7,7 @@ def check_subcommand(command, *args):
 
 
 def test_cformat():
-    assert check_subcommand('cformat', 'tmk_core/common/backlight.c').returncode == 0
+    assert check_subcommand('cformat', 'tmk_core/common/keyboard.c').returncode == 0
 
 
 def test_compile():
index 94dbf3a6a6a21b283b38f98f55a314a380cfe741..d6961a0f652fdf6c8987a7f0bd5d5f668f97bedb 100644 (file)
@@ -10,4 +10,4 @@ def test_keymap_onekey_pytest():
 
 def test_normpath():
     path = qmk.path.normpath('lib/python')
-    assert path == os.environ['ORIG_CWD'] + '/lib/python'
+    assert path == os.path.join(os.environ['ORIG_CWD'], 'lib/python')