From 5397293f332b1774bf70585da9bc0cab5870eb78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Wed, 29 Aug 2018 20:46:22 +0300 Subject: [PATCH] Export to stdout by default --- src/main-export-known-hosts.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main-export-known-hosts.py b/src/main-export-known-hosts.py index d02948c..54ece35 100644 --- a/src/main-export-known-hosts.py +++ b/src/main-export-known-hosts.py @@ -4,7 +4,6 @@ import process_known_hosts import write_file def main(): - # TODO: Don't hardcode # TODO: Handle errors # TODO: Add a switch for whether you want to include IPs with open(sys.argv[1], 'r') as f: @@ -14,8 +13,11 @@ def main(): print('Error: %s' % err, file=sys.stderr) sys.exit(1) - with open('known_hosts.sshwot', 'wb') as f: - write_file.write(f, entries) + # Write to stdout by default + # TODO: Add a way to change it + # We use sys.stdout.buffer instead of just sys.stdout because we + # are writing binary data + write_file.write(sys.stdout.buffer, entries) if __name__ == '__main__': main()