From 98ab6a52f6e5e9c17b6883932ff53303dde21141 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sun, 2 Apr 2023 10:27:46 +1000 Subject: [PATCH 1/6] Attempted formatting fix. --- qmk_cli/subcommands/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index a7fa758..9a3b440 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -142,7 +142,7 @@ def run_forever(self): message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' - cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) + cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message.replace('%', '%%')) except self.hid.HIDException: break From 6638c13c361fc58c26179ccf95e9c09b9639d78a Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Sun, 2 Apr 2023 10:32:27 +1000 Subject: [PATCH 2/6] Take 2 --- qmk_cli/subcommands/console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index 9a3b440..fa54532 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -141,8 +141,8 @@ def run_forever(self): identifier = (int2hex(message['vendor_id']), int2hex(message['product_id'])) if self.numeric else (message['manufacturer_string'], message['product_string']) message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' - - cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message.replace('%', '%%')) + message['text'] = message['text'].replace('%', '%%') + cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) except self.hid.HIDException: break From 32129ee5a2062c3d502025530d77e01cae45afdf Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 3 Apr 2023 07:43:04 +1000 Subject: [PATCH 3/6] Update qmk_cli/subcommands/console.py Co-authored-by: Sergey Vlasov --- qmk_cli/subcommands/console.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index fa54532..62a8c37 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -141,8 +141,7 @@ def run_forever(self): identifier = (int2hex(message['vendor_id']), int2hex(message['product_id'])) if self.numeric else (message['manufacturer_string'], message['product_string']) message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' - message['text'] = message['text'].replace('%', '%%') - cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) + cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s', **message) except self.hid.HIDException: break From ea62fa1cec739f1483ae12edfcde1f5115a64766 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 3 Apr 2023 07:44:30 +1000 Subject: [PATCH 4/6] Let's try that again. --- qmk_cli/subcommands/console.py | 1 + 1 file changed, 1 insertion(+) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index 62a8c37..e1b18ac 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -141,6 +141,7 @@ def run_forever(self): identifier = (int2hex(message['vendor_id']), int2hex(message['product_id'])) if self.numeric else (message['manufacturer_string'], message['product_string']) message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' + message['text'] = message['text'].replace('%', '%%') cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s', **message) except self.hid.HIDException: From dea98e71b867850816706d27fd1c3d05e553981b Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Mon, 3 Apr 2023 07:46:20 +1000 Subject: [PATCH 5/6] Revert, no work. --- qmk_cli/subcommands/console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index e1b18ac..fa54532 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -142,7 +142,7 @@ def run_forever(self): message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' message['text'] = message['text'].replace('%', '%%') - cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s', **message) + cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) except self.hid.HIDException: break From 446547df04a3fbfc8f8f87df62d1114de10a9943 Mon Sep 17 00:00:00 2001 From: Nick Brassel Date: Wed, 5 Apr 2023 18:07:39 +1000 Subject: [PATCH 6/6] Update qmk_cli/subcommands/console.py Co-authored-by: Sergey Vlasov --- qmk_cli/subcommands/console.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmk_cli/subcommands/console.py b/qmk_cli/subcommands/console.py index fa54532..dcae32a 100644 --- a/qmk_cli/subcommands/console.py +++ b/qmk_cli/subcommands/console.py @@ -141,8 +141,8 @@ def run_forever(self): identifier = (int2hex(message['vendor_id']), int2hex(message['product_id'])) if self.numeric else (message['manufacturer_string'], message['product_string']) message['identifier'] = ':'.join(identifier) message['ts'] = '{style_dim}{fg_green}%s{style_reset_all} ' % (strftime(cli.config.general.datetime_fmt),) if cli.args.timestamp else '' - message['text'] = message['text'].replace('%', '%%') - cli.echo('%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) + + cli.echo('%s', '%(ts)s%(color)s%(identifier)s:%(index)d{style_reset_all}: %(text)s' % message) except self.hid.HIDException: break