-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpoortego_cmd2_cli.py
41 lines (34 loc) · 1.03 KB
/
poortego_cmd2_cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
###
#
# Poortego CMD2 command-line interface
#
###
# Stupid absolute path inclusion snippet
import os, sys, inspect
cmd_folder = os.path.realpath(os.path.abspath(os.path.split(inspect.getfile( inspect.currentframe() ))[0]))
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
#
# Poortego Conf
#
from poortego.framework.conf import Conf
default_conf_dir = cmd_folder + '/conf/'
default_conf_file = 'poortego.conf'
poortego_conf_obj = Conf(default_conf_dir, default_conf_file)
poortego_conf_obj.display_conf_settings()
#
# Poortego Session
#
from poortego.framework.session import Session
poortego_session_obj = Session(poortego_conf_obj)
poortego_session_obj.display()
#
# Poortego Interface/Dispatcher
# [Optional TODO] have default interface/dispatcher names defined in conf
#
from poortego.interfaces.cmd2_interface import Cmd2Interface
poortego_interface_obj = Cmd2Interface(poortego_session_obj)
dispatcher_name = 'Cmd2'
poortego_interface_obj.load_dispatcher(dispatcher_name)
poortego_interface_obj.run()