Added a save command to overunder to save the pattern to a file

master
Alice 7 years ago
parent 29132ec69a
commit 8d7fa27c83

@ -36,6 +36,7 @@ def eval(cmds):
global text
global line_number
global last_index
global pattern
for cmd in cmds:
if cmd == []:
@ -75,6 +76,11 @@ def eval(cmds):
pattern = text[0:line_number + 1]
print('\n'.join(pattern))
elif cmd[0] == 'save':
pattern_file = open('output/patternfile.txt', 'w')
pattern_file.write('\n'.join(pattern))
pattern_file.close()
print('Your pattern has been saved in the output folder.')
elif cmd[0] == 'quit':
print('Come back soon!')

Loading…
Cancel
Save