Minor changes & added support for j,k keys for moving down and up in the management menu.
This commit is contained in:
parent
67c4b13b0a
commit
4304672487
|
@ -1,5 +1,5 @@
|
|||
# gempost
|
||||
An **experimental** gemlog manager for tildes.
|
||||
An **experimental** gemlog manager for tilde.team
|
||||
|
||||
# Quick Start
|
||||
Basically, gempost manages a *posts.gmi* file and maintains it in a clean format
|
||||
|
|
24
gempost
24
gempost
|
@ -87,7 +87,7 @@ def menuFunction(menu = []):
|
|||
endOfPage = len(imenu)
|
||||
highlight = endOfPage - 1
|
||||
|
||||
stdscr.addstr("Use the arrow keys to make a selection. Press 'c' to cancel.\n")
|
||||
stdscr.addstr("Use the arrow keys or j,k to make a selection. Press 'c' to cancel.\n")
|
||||
|
||||
for sno in range(len(imenu)):
|
||||
if (sno == highlight):
|
||||
|
@ -101,11 +101,11 @@ def menuFunction(menu = []):
|
|||
|
||||
c = stdscr.getch()
|
||||
|
||||
if (c == curses.KEY_DOWN):
|
||||
if (c == curses.KEY_DOWN or c == ord('j')):
|
||||
highlight_prev = highlight
|
||||
highlight += 1
|
||||
|
||||
elif (c == curses.KEY_UP):
|
||||
elif (c == curses.KEY_UP or c == ord('k')):
|
||||
highlight_prev = highlight
|
||||
highlight -= 1
|
||||
|
||||
|
@ -209,11 +209,25 @@ def newpost(title, existing_content = None):
|
|||
else:
|
||||
modified = True # modify the function if doing this for existing file
|
||||
|
||||
"""
|
||||
uf = input("\n1 - (DEFAULT) automatically generate filename using a random hash\n2 - enter filename manually\n-> ")
|
||||
if (uf == '2'):
|
||||
while True:
|
||||
filename = input("\nFilename (.gmi will be added automatically): ")
|
||||
if filename[-1] == '\n': # removing newline character that creeps in there due to input()
|
||||
filename = filename[:-1]
|
||||
if f"{filename}.gmi" in listdir(f"{wdir}postdir/"):
|
||||
prYellow("This filename already exists. Please use a different filename.")
|
||||
else:
|
||||
break
|
||||
else:
|
||||
filename = sha1(str(f"{title}{random()}").encode("utf-8")).hexdigest() # generating a unique filename
|
||||
"""
|
||||
filename = sha1(str(f"{title}{random()}").encode("utf-8")).hexdigest() # generating a unique filename
|
||||
|
||||
exec(f"touch {wdir + filename}.gmi") # creating empty file
|
||||
|
||||
ch = input("Add an ASCII Art header to your post? (define it in blogpostHeader.gmi): ([y]/n) ")
|
||||
ch = input("\nAdd an ASCII Art header to your post? (define it in blogpostHeader.gmi): ([y]/n) ")
|
||||
if (ch == 'n' or ch == 'N'):
|
||||
pass
|
||||
else:
|
||||
|
@ -315,7 +329,7 @@ def manage():
|
|||
|
||||
# information strings
|
||||
helpText = f"""
|
||||
gempost (v0.6) - *experimental* gemlog manager for tildes
|
||||
gempost (v0.6) - *experimental* gemlog manager for tilde.team
|
||||
|
||||
Available arguments:
|
||||
post - create a new post
|
||||
|
|
Loading…
Reference in New Issue