-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.py
34 lines (23 loc) · 893 Bytes
/
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
import os
import subprocess
import yaml
import click
from services.formatters import OnboardingFormatter
from services.renderer import OnboardingRenderer
@click.command()
def onboarding():
config_path = os.environ.get('ONBOARDING_FILE_PATH', 'config.yml')
config = yaml.safe_load(open(config_path, 'r'))
formatter = OnboardingFormatter(config)
renderer = OnboardingRenderer(config)
shell = subprocess.check_output('echo $SHELL', shell=True)
shell = shell.decode('utf-8').strip()
apps = '\n'.join(renderer.render_apps())
services = '\n'.join(renderer.render_services())
click.echo(formatter.get_onboarding_text(shell, apps))
want_continue = click.confirm(
'Do you want to see the services you need access to?')
if want_continue:
click.echo(formatter.get_services_text(services))
if __name__ == '__main__':
onboarding()