Skip to content

Commit

Permalink
promote: Minor prompt cleanup
Browse files Browse the repository at this point in the history
- Fixed spacing in various prompts in the 'ksconf promote' interactive mode.
  • Loading branch information
lowell80 committed Jun 1, 2019
1 parent e17194a commit 7099de6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions ksconf/commands/promote.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def run(self, args):
del source_basename

if not os.path.isfile(args.target.name):
self.stdout.write("Target file {} does not exist. Moving source file {} to the target."
self.stdout.write("Target file {} does not exist. "
"Moving source file {} to the target.\n"
.format(args.target.name, args.source.name))
# For windows: Close out any open file descriptors first
args.target.close()
Expand Down Expand Up @@ -179,7 +180,7 @@ def run(self, args):
else:
self.stderr.write(
"Refusing to promote content between different types of configuration "
"files. {0} --> {1} If this is intentional, override this safety"
"files. {0} --> {1} If this is intentional, override this safety "
"check with '--force'\n".format(bn_source, bn_target))
return EXIT_CODE_FAILED_SAFETY_CHECK

Expand All @@ -200,7 +201,7 @@ def run(self, args):
summarize_cfg_diffs(delta, self.stderr)

while True:
resp = input("Would you like to apply ALL changes? (y/n/d/q)")
resp = input("Would you like to apply ALL changes? (y/n/d/q) ")
resp = resp[:1].lower()
if resp == 'q':
return EXIT_CODE_USER_QUIT
Expand Down Expand Up @@ -304,8 +305,9 @@ def _do_promote_interactive(self, cfg_src, cfg_tgt, args):
'''

def prompt_yes_no(prompt):
print("")
while True:
r = input(prompt + " (y/n)")
r = input(prompt + " (y/n) ")
if r.lower().startswith("y"):
return True
elif r.lower().startswith("n"):
Expand Down Expand Up @@ -337,7 +339,7 @@ def prompt_yes_no(prompt):
if isinstance(op.location, DiffStanza):
# Move entire stanza
show_diff(self.stdout, [op])
if prompt_yes_no("Apply [{0}]".format(op.location.stanza)):
if prompt_yes_no("Apply [{0}]".format(op.location.stanza)):
out_cfg[op.location.stanza] = op.a
del out_src[op.location.stanza]
else:
Expand Down

0 comments on commit 7099de6

Please sign in to comment.