Skip to content

Commit

Permalink
remove extra lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Dax Harris committed Mar 21, 2024
1 parent 13eec88 commit b7e93b6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions gpyg/operators/keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,13 @@ def __init__(self, key: Key, passphrase: str | None):
self.passphrase = passphrase

def execute(self, command: str, *inputs: str):
return self.key.session.run(
f"gpg --batch --command-fd 0 --status-fd 1 --pinentry-mode loopback --with-colons --edit-key {self.key.fingerprint}",
input="\n".join([command, *inputs, "quit"]),
).output
return "\n".join(
[
line
for line in self.key.session.run(
f"gpg --batch --command-fd 0 --status-fd 1 --pinentry-mode loopback --with-colons --edit-key {self.key.fingerprint}",
input="\n".join([command, *inputs, "quit"]),
).output.splitlines()
if not line.startswith("[GNUPG:]")
]
)
2 changes: 1 addition & 1 deletion scratchpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
gpg = GPG(homedir=tmpdir, kill_existing_agent=True)
key = gpg.keys.generate_key("Bongus", passphrase="test")
with key.edit(passphrase="test") as editor:
print(editor.execute("passwd", editor.passphrase, "new-pass").splitlines())
print(editor.execute("passwd", editor.passphrase + "wrong", "new-pass"))

0 comments on commit b7e93b6

Please sign in to comment.