diff --git a/src/main-export-known-hosts.py b/src/main-export-known-hosts.py index 45d7e99..86d3185 100644 --- a/src/main-export-known-hosts.py +++ b/src/main-export-known-hosts.py @@ -1,4 +1,5 @@ import argparse +import os import sys import process_known_hosts @@ -42,8 +43,16 @@ def main(): help = 'write the sshwot file to a given file instead of the stdout' ) - # The required argument + try: + homedir = os.environ['HOME'] + except KeyError: + raise KeyError('$HOME is not set') + + # The input file + # Default to ~/.ssh/known_hosts parser.add_argument('infile', + nargs = '?', + default = homedir + '/.ssh/known_hosts', help = 'a file in .ssh/known_hosts format' )