-
Notifications
You must be signed in to change notification settings - Fork 1
/
__init__.py
41 lines (29 loc) · 859 Bytes
/
__init__.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
import os
import click
from marathon_cli.settings import PLUGIN_FOLDER
class MarathonCli(click.MultiCommand):
def list_commands(self, ctx):
rv = []
for filename in os.listdir(PLUGIN_FOLDER):
if filename == '__init__.py':
continue
if filename.endswith('.py'):
rv.append(filename[:-3])
rv.sort()
return rv
def get_command(self, ctx, name):
ns = {}
fn = os.path.join(PLUGIN_FOLDER, name + '.py')
with open(fn) as f:
code = compile(f.read(), fn, 'exec')
eval(code, ns, ns)
return ns['cli']
main = MarathonCli(
help='cli helpers for the marathon api.',
context_settings=dict(
help_option_names=['-h', '--help', '?']
)
)
if __name__ == '__main__':
main()
__version__ = '1.1.5'