sshwot-export-known-hosts exports ~/.ssh/known_hosts by default

This commit is contained in:
Juhani Krekelä 2018-08-31 20:52:55 +03:00
parent c1c8890319
commit e6b3345421
1 changed files with 10 additions and 1 deletions

View File

@ -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'
)