Skip to content

Commit

Permalink
Merge pull request #64 from fgimian/display_cleanup
Browse files Browse the repository at this point in the history
Cleaned up white space display which was particularly bad in non-interactive mode
  • Loading branch information
domenkozar committed Mar 3, 2014
2 parents f63ec50 + 544efe6 commit 15d4ee0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
23 changes: 16 additions & 7 deletions mrbob/cli.py
Expand Up @@ -122,7 +122,9 @@ def main(args=sys.argv[1:]):

c = None
if bobconfig['verbose']:
print('')
print('Configuration provided:')
print('')
print('[variables] from ~/.mrbob')
for line in pretty_format_config(original_global_variables):
print(line)
Expand Down Expand Up @@ -152,7 +154,6 @@ def main(args=sys.argv[1:]):
print('[mr.bob] from command line interface')
for line in pretty_format_config(cli_bobconfig):
print(line)
print('\n')

try:
c = Configurator(template=options.template,
Expand All @@ -165,16 +166,24 @@ def main(args=sys.argv[1:]):
return c.print_questions()

if c.questions and not maybe_bool(bobconfig['quiet']):
print("Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.")
print("")
print("Answer with a question mark to display help.")
print("Values in square brackets at the end of the questions show the default value if there is no answer.")
print("\n")
if options.non_interactive:
print('')
print('Welcome to mr.bob non-interactive mode. Questions will be answered by default values or hooks.')
print('')
else:
print('')
print('Welcome to mr.bob interactive mode. Before we generate directory structure, some questions need to be answered.')
print('')
print('Answer with a question mark to display help.')
print('Values in square brackets at the end of the questions show the default value if there is no answer.')
print('\n')
c.ask_questions()
print("")
if not options.non_interactive:
print('')
c.render()
if not maybe_bool(bobconfig['quiet']):
print("Generated file structure at %s" % os.path.realpath(options.target_directory))
print('')
return
except TemplateConfigurationError as e:
parser.error(six.u('TemplateConfigurationError: %s') % e.args[0])
Expand Down
3 changes: 2 additions & 1 deletion mrbob/configurator.py
Expand Up @@ -340,5 +340,6 @@ def ask(self, configurator):
print('\nExiting...')
sys.exit(0)

print('')
if not non_interactive:
print('')
return correct_answer

0 comments on commit 15d4ee0

Please sign in to comment.