Add header command (not in help menu)
This commit is contained in:
parent
0203ec0fd3
commit
81f334667e
@ -144,19 +144,27 @@ class Onionr:
|
|||||||
self.execute(command)
|
self.execute(command)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def exitSigterm(self, signum, frame):
|
def exitSigterm(self, signum, frame):
|
||||||
self.killed = True
|
self.killed = True
|
||||||
|
|
||||||
def setupConfig(dataDir, self = None):
|
def setupConfig(dataDir, self = None):
|
||||||
setupconfig.setup_config(dataDir, self)
|
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.'):
|
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:
|
if os.path.exists('static-data/header.txt') and logger.get_level() <= logger.LEVEL_INFO:
|
||||||
with open('static-data/header.txt', 'rb') as file:
|
with open('static-data/header.txt', 'rb') as file:
|
||||||
# only to stdout, not file or log or anything
|
# 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))
|
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):
|
def doExport(self, bHash):
|
||||||
exportDir = self.dataDir + 'block-export/'
|
exportDir = self.dataDir + 'block-export/'
|
||||||
@ -220,13 +228,13 @@ class Onionr:
|
|||||||
|
|
||||||
def showDetails(self):
|
def showDetails(self):
|
||||||
commands.onionrstatistics.show_details(self)
|
commands.onionrstatistics.show_details(self)
|
||||||
|
|
||||||
def openHome(self):
|
def openHome(self):
|
||||||
commands.open_home(self)
|
commands.open_home(self)
|
||||||
|
|
||||||
def addID(self):
|
def addID(self):
|
||||||
commands.pubkeymanager.add_ID(self)
|
commands.pubkeymanager.add_ID(self)
|
||||||
|
|
||||||
def changeID(self):
|
def changeID(self):
|
||||||
commands.pubkeymanager.change_ID(self)
|
commands.pubkeymanager.change_ID(self)
|
||||||
|
|
||||||
@ -385,7 +393,7 @@ class Onionr:
|
|||||||
'''
|
'''
|
||||||
Displays a message suggesting help
|
Displays a message suggesting help
|
||||||
'''
|
'''
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
logger.info('Do ' + logger.colors.bold + sys.argv[0] + ' --help' + logger.colors.reset + logger.colors.fg.green + ' for Onionr help.')
|
logger.info('Do ' + logger.colors.bold + sys.argv[0] + ' --help' + logger.colors.reset + logger.colors.fg.green + ' for Onionr help.')
|
||||||
|
|
||||||
def start(self, input = False, override = False):
|
def start(self, input = False, override = False):
|
||||||
|
@ -53,6 +53,7 @@ def get_commands(onionr_inst):
|
|||||||
return {'': onionr_inst.showHelpSuggestion,
|
return {'': onionr_inst.showHelpSuggestion,
|
||||||
'help': onionr_inst.showHelp,
|
'help': onionr_inst.showHelp,
|
||||||
'version': onionr_inst.version,
|
'version': onionr_inst.version,
|
||||||
|
'header': onionr_inst.cmdHeader,
|
||||||
'config': onionr_inst.configure,
|
'config': onionr_inst.configure,
|
||||||
'start': onionr_inst.start,
|
'start': onionr_inst.start,
|
||||||
'stop': onionr_inst.killDaemon,
|
'stop': onionr_inst.killDaemon,
|
||||||
@ -168,4 +169,4 @@ cmd_help = {
|
|||||||
'add-id': 'Generate a new ID (key pair)',
|
'add-id': 'Generate a new ID (key pair)',
|
||||||
'change-id': 'Change active ID',
|
'change-id': 'Change active ID',
|
||||||
'open-home': 'Open your node\'s home/info screen'
|
'open-home': 'Open your node\'s home/info screen'
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user