1
Fork 0
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.
dotfile-automator/project/export/cli.py
2015-12-06 11:00:43 +00:00

21 lines
567 B
Python

import click
from project.export import exports
@click.command('export')
@click.argument('sections', nargs=-1)
def cli(sections):
functions = [f for k, f in exports.__dict__.items() if is_function(f)]
if sections: # If they don't want to export everything
temp_functions = functions
functions = []
for func in temp_functions:
if func.__name__ in sections:
functions.append(func)
for func in functions:
func()
return 0
def is_function(item):
return type(item).__name__ == 'function'