-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
31 lines (23 loc) · 832 Bytes
/
main.py
File metadata and controls
31 lines (23 loc) · 832 Bytes
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
import asyncclick as click
import os
plugin_folder = os.path.join(os.path.dirname(__file__), 'commands')
class GithubDeploy(click.MultiCommand):
def list_commands(self, ctx):
rv = []
for filename in os.listdir(plugin_folder):
if filename.endswith('.py') and not filename.startswith('__init__') and not filename.startswith('_'):
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['main']
main = GithubDeploy(
help='Deploy changes to multiple github repositories using a single command.',
)
if __name__ == '__main__':
main()