This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
2015-12-05 22:35:18 +00:00
|
|
|
import click
|
2015-12-05 23:25:26 +00:00
|
|
|
from project.export import exports
|
|
|
|
|
2015-12-05 22:35:18 +00:00
|
|
|
|
|
|
|
@click.command('export')
|
|
|
|
@click.argument('sections', nargs=-1)
|
|
|
|
def cli(sections):
|
2015-12-05 23:25:26 +00:00
|
|
|
functions = [f for k, f in exports.__dict__.items() if is_function(f)]
|
|
|
|
print("got all functions", functions)
|
|
|
|
if sections: # If they don't want to export everything
|
|
|
|
print("YOu specified sections")
|
|
|
|
for func in functions:
|
|
|
|
if func.__name__ not in sections:
|
|
|
|
print("{} not in {}".format(func.__name__, sections))
|
|
|
|
functions.remove(func)
|
|
|
|
print("Calling functions", functions)
|
|
|
|
for func in functions:
|
|
|
|
print("Calling", func.__name__)
|
|
|
|
func()
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
|
|
|
def is_function(item):
|
|
|
|
return type(item).__name__ == 'function'
|