Skip to content

Commit

Permalink
cockpit.print: Fix kwargs parsing
Browse files Browse the repository at this point in the history
.rpartition() will try to break this:

    foo="bar=baaz"

on the second equals sign instead of the first.  Change it to
.partition().
  • Loading branch information
allisonkarlitskaya authored and jelly committed Feb 1, 2023
1 parent 5357446 commit afe332d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cockpit/print.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def main():
func = getattr(printer, command[0])

for param in command[1:]:
left, _, right = param.rpartition('=')
left, eq, right = param.partition('=')

# Does that look like a kwarg?
if left.replace('-', '_').isidentifier():
if eq and left.replace('-', '_').isidentifier():
key = left
param = right
else:
Expand Down

0 comments on commit afe332d

Please sign in to comment.