Fix initial_text None.

This commit is contained in:
voussoir 2021-09-22 23:20:15 -07:00
parent c298949d98
commit 56cd1065f9
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -72,11 +72,13 @@ def tempeditor(initial_text=None):
raise BadStatus(subproctools.format_command(command), status) raise BadStatus(subproctools.format_command(command), status)
def tempeditor_argparse(args): def tempeditor_argparse(args):
if args.initial_text is not None: if args.initial_text is None:
initial_text = None
else:
initial_text = pipeable.input(args.initial_text, split_lines=False) initial_text = pipeable.input(args.initial_text, split_lines=False)
try: try:
text = tempeditor(initial_text=args.initial_text) text = tempeditor(initial_text=initial_text)
pipeable.stdout(text) pipeable.stdout(text)
return 0 return 0
except NoEditor as exc: except NoEditor as exc: