def replset_print_file(self, ctx, choice=None):
"""write results to a file, optionally opening in subl/atom
Choices: nothing | subl | subl.exe | atom | atom.exe"""
author = ctx.message.author
choices = ['subl', 'subl.exe', 'atom', 'atom.exe']
if choice not in choices + [None, 'nothing']:
await send_cmd_help(ctx)
return
if choice is None:
msg = ("You chose to print to file. What would you like to open it with?\n"
"Choose between: {}".format(' | '.join(choices + ['nothing'])))
choice = await self.user_choice(author, msg, choices)
msg = "repl overflow will now go to file and "
if choice not in choices:
msg += "I won't open it after writing to {}".format(self.output_file)
choice = None
else:
msg += ("the output will be opened with: `{} "
"{}`".format(choice, self.output_file))
self.settings['OPEN_CMD'] = choice
self.settings["OUTPUT_REDIRECT"] = "file"
dataIO.save_json("data/repl/settings.json", self.settings)
await self.bot.say(msg)
评论列表
文章目录