Skip to content

Commit

Permalink
Small CLI cleanups
Browse files Browse the repository at this point in the history
* yapf changes
* Fix the cformat test
* Make the normpath test work when run from /
* `qmk config`: Mark `--read-only` as arg_only
  • Loading branch information
skullydazed committed Nov 13, 2019
1 parent d1b6c11 commit 79edb7c
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/python/qmk/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions lib/python/qmk/cli/list/keyboards.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from milc import cli


@cli.subcommand("List the keyboards currently defined within QMK")
def list_keyboards(cli):
"""List the keyboards currently defined within QMK
Expand Down
1 change: 0 additions & 1 deletion lib/python/qmk/errors.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
class NoSuchKeyboardError(Exception):
"""Raised when we can't find a keyboard/keymap directory.
"""

def __init__(self, message):
self.message = message
1 change: 0 additions & 1 deletion lib/python/qmk/tests/attrdict.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion lib/python/qmk/tests/test_cli_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion lib/python/qmk/tests/test_qmk_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit 79edb7c

Please sign in to comment.