0
0
Fork 0

Fixed print error and added ability to print guide

This commit is contained in:
sloumdrone 2018-12-21 21:52:34 -08:00
parent 7774a28df1
commit 1987f76fb7
1 changed files with 12 additions and 7 deletions

19
chalk
View File

@ -80,12 +80,14 @@ def chalk(path):
helptext = [
"",
"{}Commands are entered as the only entry for their row:{}".format(c.yellow, c.end),
" . - Finish writing/exit, will prompt for save",
" !? - Print this help message",
" !d - Display the contents of the file",
" !# - Rewrite a line, # is replaced by line number e.g. !27",
" !x - Delete line(s), prompt will request line or range",
" !i - Insert line(s), prompt will request start point and optional quantity",
" {}.{} - Finish writing/exit, will prompt for save".format(c.b_green, c.end),
" {}!?{} - Print this help message".format(c.b_green, c.end),
" {}!d{} - Display the contents of the file".format(c.b_green, c.end),
" {}!v{} - View lines, prompt will request a range of lines".format(c.b_green, c.end),
" {}!#{} - Rewrite a line, # is replaced by line number e.g. !27".format(c.b_green, c.end),
" {}!x{} - Delete line(s), prompt will request line or range".format(c.b_green, c.end),
" {}!i{} - Insert line(s), prompt will request start point and optional quantity".format(c.b_green, c.end),
" {}!g{} - Print the ruler/guide".format(c.b_green, c.end),
""
]
@ -109,6 +111,9 @@ def chalk(path):
print('{:8} {}'.format(' ',x))
print('')
print(header)
elif ln == '!g':
print('')
print(header)
elif ln == '!d':
print('')
for i, x in enumerate(content):
@ -171,7 +176,7 @@ def chalk(path):
print(header)
except:
print('{}{:8} Invalid entry{}'.format(c.red, c.end))
print('{}{:8} Invalid entry{}'.format(c.red, ' ', c.end))
elif re.match(r'^\!\d+$',ln):
try:
row = int(ln[1:])