Fix traceback when no args are passed to reno

When a user passes no args to reno, we'll now properly display the
help message.

  $ reno
  Traceback (most recent call last):
    File "/home/pabelanger/git/openstack/reno/.tox/pep8/bin/reno", line 10, in <module>
      sys.exit(main())
    File "/home/pabelanger/git/openstack/reno/reno/main.py", line 200, in main
      conf = config.Config(args.reporoot, args.relnotesdir)
  AttributeError: 'Namespace' object has no attribute 'reporoot'

Change-Id: I9b9fdd044f43a05ced299dbb941de60d2bbc7192
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2018-06-27 08:17:14 -04:00
parent e8bb93f673
commit e0c6b84051
No known key found for this signature in database
GPG Key ID: 611A80832067AF38
1 changed files with 7 additions and 0 deletions

View File

@ -88,6 +88,9 @@ def main(argv=sys.argv[1:]):
)
subparsers = parser.add_subparsers(
title='commands',
description='valid commands',
dest='command',
help='additional help',
)
do_new = subparsers.add_parser(
@ -191,6 +194,10 @@ def main(argv=sys.argv[1:]):
do_linter.set_defaults(func=linter.lint_cmd)
args = parser.parse_args(argv)
# no arguments, print help messaging, then exit with error(1)
if not args.command:
parser.print_help()
return 1
logging.basicConfig(
level=args.verbosity,