Minor changes.

This commit is contained in:
= 2022-06-05 20:18:51 +05:30
parent c65600e667
commit 7e335eb01d
1 changed files with 12 additions and 6 deletions

18
gempost
View File

@ -131,14 +131,12 @@ def checkInit():
for i in contents:
if i in valid_contents:
validity += 1
else:
missing.append(i)
if (validity != len(valid_contents)):
if (validity == 0):
prRed(f'\n Your "public_gemini/" directory has not been initialized yet. Use "gempost qs" to read the quickstart.')
else:
prRed(f'\n Your "public_gemini/" directory is missing some required files and directories / has not been properly initialized.\n\n The following files/directories are missing: {missing}\n Validity score: {validity}/{len(valid_contents)}')
prRed(f'\n Your "public_gemini/" directory is missing some required files and directories / has not been properly initialized.\n\n The following files/directories are required: {valid_contents}\n Validity score: {validity}/{len(valid_contents)}')
exit()
def rebuildReferences(filename = None, title = None, callingFrom = "default"):
@ -246,7 +244,7 @@ def newpost(title, existing_content = None):
exec(f"mv {wdir+filename}.gmi {postDir+filename}.gmi") # moving file to postdir
elif (ch == 'c'):
exec(f"mv {wdir+filename}.gmi {wdir}trash/")
print("Cancelled")
print("\nCancelled.")
return None
else:
exec(f"mv {wdir+filename}.gmi {postDir+filename}.gmi") # moving file to postdir without review
@ -341,6 +339,9 @@ Available arguments:
desc - a brief description of how the program works
\033[93mqs - Quick Start for new users\033[00m
Source at:
https://tildegit.org/desertmouse/gempost
"""
quickStart = """
@ -355,11 +356,13 @@ proceed with the given steps.
Quickstart:
STEP 1
Wih only your index.gmi file in public_gemini/ , run the following to set everyting up:
With only your index.gmi file in public_gemini/ , run the following to set everyting up:
gempost init
STEP 2
Skip this if you chose to initialize an index.gmi during gempost init.
gempost doesn't touch your index.gmi file, so you will have to manually add a link to "posts.gmi"
To do that, just add the following line to your index.gmi file:
@ -457,6 +460,9 @@ elif (arg == "search"):
if (len(argv) >= 3): # getting search term from args
t = argv[2]
if (t == ''): # if empty search term given, skip looping to search all posts and just open the normal manage mode
manage()
exit()
else:
prYellow("No search term specified.")
exit()
@ -474,7 +480,7 @@ elif (arg == "search"):
for i in postsList: # formatting it into a string list for the ncurses menu function
menuItems.append(f"{i[0]} | {i[1]}")
which = menuFunction(menuItems, "Search listing:\n")
which = menuFunction(menuItems, f"Search listing for '{t}':\n")
if (which == None): # menuFunction returns None if the list supplied to it is empty
print("\nNo items found.")