remove ignore_pubkey param, treat http as special case
unify common parts of build_register_command
Merge branch 'bug9975'

Use argparse instead of getopt and factor out much duplicate code.