Aggiornare 'crapup/crapup.py'

This commit is contained in:
Valentino Orlandi 2022-06-12 23:33:03 +00:00
parent cfd8b70eea
commit 88d1e1cc50
1 changed files with 24 additions and 11 deletions

View File

@ -1,7 +1,7 @@
from sys import argv
from os import abspath
from time import sleep
from os.path import abspath
from crappy import aux
from crappy.git import gitPull
@ -11,6 +11,7 @@ from crappy.get import versionCheck
class Crapup():
def __init__(self, args:list ):
# declare variables
self.use_configs: bool
self.use_arguments: bool
self.less_output: bool
self.more_output: bool
@ -19,6 +20,7 @@ class Crapup():
# paths
self.crappath: str
# messages
self.text_colors: dict
self.MSG_elbarto: str
self.MSG_craplogo: str
self.MSG_help: str
@ -37,7 +39,7 @@ class Crapup():
self.parseArguments( args )
def initVariables():
def initVariables(self):
"""
Initialize Crapup's variables
This section can be manually edited to pre-set Crapup
@ -46,10 +48,21 @@ class Crapup():
################################################################
# START OF THE EDITABLE SECTION
#
# HIERARCHY FOR APPLYING SETTINGS:
# - HARDCODED VARIABLES (THESE)
# - CONFIGURATIONS FILE
# - COMMAND LINE ARGUMENTS
# THE ELEMENTS ON TOP ARE REPLACED BY THE ONES WHICH FOLLOW THEM,
# IF HARDCODED VARIABLES ARE SET TO DO SO
#
# READ THE CONFIGURATIONS FILE AND LOAD THE SETTING
# [ ]
# IF SET TO 'False' MEANS THAT THE SAVED CONFIGS WILL BE IGNORED
self.use_configs = True
#
# USE COMMAND LINE ARGUMENTS
# [ ]
# SETTING THIS VARIABLE TO 'False' MEANS THAT EVERY ARGUMENT WILL BE IGNORED
# ONLY THE MANUAL CONFIGURATION OF THESE VARIABLES WILL BE USED
# IF SET TO 'False' MEANS THAT EVERY ARGUMENT WILL BE IGNORED
self.use_arguments = True
#
# REDUCE THE OUTPUT ON SCREEN
@ -84,7 +97,7 @@ class Crapup():
self.TXT_crapup = self.TXT_fin =\
self.TXT_craplog = ""
self.use_colors = True
self.colors = aux.colors()
self.text_colors = aux.colors()
def initMessages(self):
@ -94,10 +107,10 @@ class Crapup():
# set-up colors
if self.use_colors is False:
self.text_colors = aux.no_colors()
self.MSG_elbarto = aux.elbarto()
self.MSG_help = aux.help( self.text_colors )
self.MSG_examples = aux.examples( self.text_colors )
self.MSG_elbarto = aux.elbarto( self.text_colors )
self.MSG_craplogo = aux.craplogo( self.text_colors )
self.MSG_craplogo = aux.craplogo()
self.MSG_crapup = aux.crapup( self.text_colors )
self.MSG_fin = aux.fin( self.text_colors )
self.TXT_crapup = "{red}c{orange}r{grass}a{cyan}p{white}UP{default}".format(**self.text_colors)
@ -169,16 +182,16 @@ class Crapup():
%( self.TXT_fin ))
def printError( err_key:str, message:str ):
def printError(self, err_key:str, message:str ):
"""
Print an error message
"""
print("\n{err}Error{white}[{grey}%s{white}]{red}>{default} %s{default}"\
.format(**cself.text_colors)\
.format(**self.text_colors)\
%( err_key, message ))
def exitAborted():
def exitAborted(self):
"""
Print the abortion message and exit
"""
@ -189,7 +202,7 @@ class Crapup():
exit()
def main():
def main(self):
"""
Main function to call
"""