Add a suitable default for '-b'

Most OpenStack doc projects contain only one book anyway, thus use the
first book found in ./doc/ as the default.

Avoids an unhelpful exception if -b is not specified.

Change-Id: I103ddbcf2cb0b3781926896ae78a26ed86b74257
This commit is contained in:
Sascha Peilicke 2014-02-06 11:52:07 +01:00
parent 131a50461b
commit 257c4f35c9
1 changed files with 6 additions and 1 deletions

View File

@ -119,6 +119,11 @@ def get_xml_list (sms, dr, flst):
if ((f.endswith(".xml") and (f != "pom.xml"))) :
sms.append(os.path.join(dr,f))
def get_default_book():
return os.listdir(root)[0]
def main(argv):
usage = "usage: %prog [options] command [cmd_options]"
@ -133,7 +138,7 @@ def main(argv):
"-l", "--language", dest="language", help=("specified language")
)
parser.add_option(
"-b", "--book", dest="book", help=("specified docbook")
"-b", "--book", dest="book", default=get_default_book(), help=("specified docbook")
)
(options, args) = parser.parse_args()
if (options.language == None) :