Add header command (not in help menu)
This commit is contained in:
parent
0203ec0fd3
commit
81f334667e
@ -151,12 +151,20 @@ class Onionr:
|
||||
def setupConfig(dataDir, self = None):
|
||||
setupconfig.setup_config(dataDir, self)
|
||||
|
||||
def cmdHeader(self):
|
||||
if len(sys.argv) >= 3:
|
||||
self.header(logger.colors.fg.pink + sys.argv[2].replace('Onionr', logger.colors.bold + 'Onionr' + logger.colors.reset + logger.colors.fg.pink))
|
||||
else:
|
||||
self.header(None)
|
||||
|
||||
def header(self, message = logger.colors.fg.pink + logger.colors.bold + 'Onionr' + logger.colors.reset + logger.colors.fg.pink + ' has started.'):
|
||||
if os.path.exists('static-data/header.txt') and logger.get_level() <= logger.LEVEL_INFO:
|
||||
with open('static-data/header.txt', 'rb') as file:
|
||||
# only to stdout, not file or log or anything
|
||||
sys.stderr.write(file.read().decode().replace('P', logger.colors.fg.pink).replace('W', logger.colors.reset + logger.colors.bold).replace('G', logger.colors.fg.green).replace('\n', logger.colors.reset + '\n').replace('B', logger.colors.bold).replace('A', '%s' % API_VERSION).replace('V', ONIONR_VERSION))
|
||||
logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n', sensitive=True)
|
||||
|
||||
if not message is None:
|
||||
logger.info(logger.colors.fg.lightgreen + '-> ' + str(message) + logger.colors.reset + logger.colors.fg.lightgreen + ' <-\n', sensitive=True)
|
||||
|
||||
def doExport(self, bHash):
|
||||
exportDir = self.dataDir + 'block-export/'
|
||||
|
@ -53,6 +53,7 @@ def get_commands(onionr_inst):
|
||||
return {'': onionr_inst.showHelpSuggestion,
|
||||
'help': onionr_inst.showHelp,
|
||||
'version': onionr_inst.version,
|
||||
'header': onionr_inst.cmdHeader,
|
||||
'config': onionr_inst.configure,
|
||||
'start': onionr_inst.start,
|
||||
'stop': onionr_inst.killDaemon,
|
||||
|
Loading…
Reference in New Issue
Block a user