minor changes.

This commit is contained in:
= 2022-07-06 00:31:53 +05:30
parent 0c2d953577
commit a129d3c2c9
1 changed files with 5 additions and 5 deletions

10
gempost
View File

@ -3,8 +3,7 @@
# gempost - experimental gemlog manager for tilde.team, written by ~desertmouse
from os import system as exec
from os import listdir
from os import getlogin
from os import listdir, getlogin
from sys import argv
@ -31,7 +30,8 @@ indexFile = wdir + "postIndex" # the index is maintained in this file
editor = "nano --restricted -t"
def menuFunction(menu = [], headerLine = "Use the arrow keys or j,k to make a selection. Press 'c' to cancel.\n"):
stdscr = curses.initscr() # initializing curses
"""An ncurses menu that integrates with both <manage> and <search> arguments."""
stdscr = curses.initscr() # initializing ncurses
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
@ -111,7 +111,7 @@ def menuFunction(menu = [], headerLine = "Use the arrow keys or j,k to make a se
elif (c == curses.KEY_ENTER or c == 10 or c == 13):
break
elif (c == ord('c')):
elif (c == ord('c') or c == ord('q')):
highlight = None
break
@ -309,7 +309,7 @@ def manage(direct = ""):
else:
print(f'\nEditing {direct}.gmi')
exec(f"{editor} {postDir}{direct}.gmi")
prGreen("\nPost updated.")
prGreen("\n Post updated.")
elif (mode == 2): # for DELETE mode, first delete post file, delete its reference from {wdir}postIndex, and rebuild the {wdir}posts.gmi and {postDir}archive.gmi files
if (direct == ""):
exec(f"mv {postDir}{postsList[which][0]}.gmi {wdir}trash/")