stdout: colors and messages

This commit is contained in:
Cyrille L 2023-01-03 14:52:43 +01:00
parent 739236bc47
commit b62137bc0e
1 changed files with 21 additions and 17 deletions

View File

@ -30,7 +30,6 @@ arguments = (
'-F', 'force' '-F', 'force'
) )
# Settings # Settings
#--------- #---------
domain_active = False domain_active = False
@ -104,6 +103,12 @@ headers = (
'raw:', 'raw:',
'#' '#'
) )
# Colors
CS = '\033[0;0m'
CR = '\033[1;31m'
CY = '\033[1;33m'
CG = '\033[1;32m'
# Words and template Tags (paragraphs, lists, bold, strong...) # Words and template Tags (paragraphs, lists, bold, strong...)
# Used to check, and replace (wip) tags # Used to check, and replace (wip) tags
@ -339,11 +344,10 @@ def protect_icodes(post_bottom, article_bottom):
# Protect block-Codes, quotes # # Protect block-Codes, quotes #
# Also remove commented lines # # Also remove commented lines #
# Used in check and wip # # Used in check and wip #
# For check, create new article without bcode # # check: create string without quotes, bcode #
# For wip, remplace content with base64 # # wip: remplace quotes, bcode with base64 #
#---------------------------------------------# #---------------------------------------------#
def protect_bcodes_quotes(process, post_bottom, article_bottom): def protect_bcodes_quotes(process, post_bottom, article_bottom):
global protect_article global protect_article
global nbr_titles, nbr_bcodes, nbr_quotes # Stats for DB global nbr_titles, nbr_bcodes, nbr_quotes # Stats for DB
in_bcode = in_quote = False in_bcode = in_quote = False
@ -470,21 +474,21 @@ def replace_in_db(post_db, process, hash_post):
#--------------------------------# #--------------------------------#
def exiting(nbr, value, out): def exiting(nbr, value, out):
nbrs = { nbrs = {
'1' : ':< \033[1;31mUnused ressource\033[0;0m: "%s"'%value, '1' : ':< %sUnused ressource%s: %s'%(CR, CS, value),
'2' : ':< \033[1;31mIncomplete data\033[0;0m: "%s"'%value, '2' : ':< %sIncomplete data%s: "%s"'%(CR, CS, value),
'3' : ':< \033[1;31mInvalid data\033[0;0m: "%s"'%value, '3' : ':< %sInvalid data%s: "%s"'%(CR, CS, value),
'4' : ':< \033[1;31mNo database yet\033[0;0m. Check article first.', '4' : ':< %sNo database yet%s. Check article first.'%(CR, CS),
'5' : ':< \033[1;31mUnused argument\033[0;0m file', '5' : ':< %sUnused argument%s: [file]'%(CR, CS),
'6' : ':< \033[1;31mUnused "%s"\033[0;0m in article'%value, '6' : ':< %sUnused "%s"%s in article'%(CR, CS, value),
'7' : ':< Article is \033[1;31mnot valid yet\033[0;0m', '7' : ':< Article is %snot valid yet%s'%(CR, CS),
'8' : ':< %s: \033[1;31mnot paired\033[0;0m'%value, '8' : ':< %s: %snot paired%s'%(value, CR, CS),
'9' : ':D Article has changed (wip is old)', '9' : ':D Article has changed (wip is old)',
'10' : ':< \033[1;31mUnused "%s"\033[0;0m in article\'s header'%value, '10' : ':< %sUnused "%s"%s in article\'s header'%(CR, value, CS),
'20' : ':D Article already up-to-date on: %s'%value, '20' : ':D %sUp-to-date%s article on: %s'%(CG, CS, value),
'21' : ':D \033[1;32mArticle is valid\033[0;0m and ready to wip', '21' : ':D %sValid%s article to wip'%(CG, CS),
'22' : ':? Symbols: %s \033[1;33mnot paired\033[0;0m'%value, '22' : ':? Symbols: %s \033[1;33mnot paired\033[0;0m'%value,
'23' : ':? \033[1;33mDatabase was corrupt\033[0;0m: %s'%value, '23' : ':? %sCorrupted database%s: %s'%(CY, CS, value),
'24' : ':? \033[1;33mMissing wip file\033[0;0m: %s'%value, '24' : ':? %sMissing wip file%s: %s'%(CY, CS, value),
'255' : ':| Maybe later...' '255' : ':| Maybe later...'
} }