Onionr/onionr/onionrcommands/parser/arguments.py

27 lines
956 B
Python
Raw Normal View History

2019-08-04 04:52:57 +00:00
from .. import onionrstatistics, version, daemonlaunch, keyadders
2019-07-31 05:10:28 +00:00
import onionrexceptions
2019-08-04 04:52:57 +00:00
import onionrevents as events
2019-07-31 05:10:28 +00:00
def get_arguments():
'''This is a function because we need to be able to dynamically modify them with plugins'''
args = {
('details', 'info'): onionrstatistics.show_details,
('version'): version.version,
2019-08-04 04:52:57 +00:00
('start', 'daemon'): daemonlaunch.start,
('stop', 'kill'): daemonlaunch.kill_daemon,
('add-address', 'addaddress', 'addadder'): keyadders.add_address
2019-07-31 05:10:28 +00:00
}
2019-08-04 04:52:57 +00:00
args = events.event('init', data=args, threaded=False)
print(args)
2019-07-31 05:10:28 +00:00
return args
def get_help():
return
def get_func(argument):
argument = argument.lower()
args = get_arguments()
for arg in args.keys(): # Iterate command alias sets
if argument in arg: # If our argument is in the current alias set, return the command function
return args[arg]
raise onionrexceptions.NotFound