-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoar.py
205 lines (160 loc) · 4.84 KB
/
soar.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import click
import os
from config import (
configure_github_settings,
configure_jhed_credentials,
configure_keyring_password,
get_home_directory,
get_is_configured,
run_link_config,
run_reset_keyring,
run_select_config_options,
)
from enhance import (
run_select_enhance_options,
)
from install import run_select_install_options
from logo import print_logo
from make import run_select_make_options
from mount import run_select_mount_options
from ohdsi import run_select_ohdsi_options
from pmap import run_select_pmap_options
from project import run_select_project_options
from status import run_show_status
if __name__ == "__main__":
print_logo()
if not get_is_configured():
click.secho("Welcome to Crunchr!", fg="blue", bold=True)
click.secho(
"Let's get started by configuring your security credentials\n", fg="green"
)
configure_keyring_password()
configure_jhed_credentials()
click.secho("🎉 Initial configuration complete.", fg="blue", bold=True)
if click.confirm(
"Would you like to configure your GitHub credentials?", default=True
):
configure_github_settings()
else:
click.secho(
"Type `soar configure` to further configure your profile.", fg="blue"
)
click.secho("Type `soar` to see what else you can do.", fg="blue")
exit(0)
@click.group()
@click.pass_context
def main(ctx):
"""Tooling to make Crunchr soar."""
@main.command()
@click.argument("setting", required=False)
@click.pass_context
def configure(ctx, setting=None):
"""
Configure your Crunchr container
Options:\n
- jhed: Set your JHED credentials\n
- github: Set your GitHub credentials\n
- keyring: Set your keyring password
"""
run_select_config_options(ctx, setting)
@main.command()
@click.pass_context
def reset_keyring(ctx):
"""Reset your keyring"""
run_reset_keyring(ctx)
@main.command()
@click.argument("option", required=False)
@click.pass_context
def install(ctx, option=None):
"""
Install useful packages and software
Options:\n
- r-data-tools: R data tools (e.g., Tidyverse, database connectors)\n
- r-data-analysis: R data analysis packages (e.g., MLM, Bayes, MICE)\n
- r-ohdsi: R OHDSI packages\n
- r-data-suite: R tools and analysis packages\n
- all: Install all\n
"""
run_select_install_options(ctx, option)
@main.command()
@click.pass_context
def link_config(ctx):
"""Relink your configuration files"""
run_link_config()
click.secho("✅ Config relinked.", fg="green")
@main.command()
@click.argument("option", required=False)
@click.pass_context
def mount(ctx, option=None):
"""
Mount network volumes on your container
Mount options:\n
- home: Mount your home directory to your container\n
- safe: Mount a SAFE directory to your container\n
"""
run_select_mount_options(ctx, option)
@main.command()
@click.argument("option", required=False)
@click.pass_context
def enhance(ctx, option=None):
"""
Enhance your Crunchr container
Options:\n
- aliases: Install enhanced aliases only\n
- rstudio-keybindings: Install enhanced keybindings\n
- shell: Enhance your shell with Zsh and aliases\n
"""
run_select_enhance_options(ctx, option)
@main.command()
@click.pass_context
def make(ctx):
"""
Make files using templates (e.g., database config files)
Options:\n
- dbi-connect: Make an ODBC DBI connection file\n
- kerberos: Scaffold Kerberos authentication\n
"""
run_select_make_options(ctx, None)
@main.command()
@click.argument("setting", required=False)
@click.pass_context
def project(ctx, setting=None):
"""
Project tools
Options:\n
- generic: Configure a generic project\n
- pmap: Configure a PMAP project\n
- existing: Configure an existing project\n
"""
run_select_project_options(ctx, setting)
@main.command()
@click.argument("setting", required=False)
@click.pass_context
def pmap(ctx, setting=None):
"""
PMAP tools
Options:\n
- project: Configure a PMAP project\n
- existing: Configure an existing project\n
- dbi-connect: Create a DBI connection file for an existing project\n
"""
run_select_pmap_options(ctx, setting)
@main.command()
@click.argument("setting", required=False)
@click.pass_context
def ohdsi(ctx, setting=None):
"""
OHDSI tools
Options:\n
- project: Configure a PMAP project\n
- existing: Configure an existing project\n
- install: Install OHDSI tools and R packages\n
"""
run_select_ohdsi_options(ctx, setting)
@main.command()
@click.pass_context
def status(ctx):
"""Show details about your configuration and projects"""
run_show_status(ctx)
if __name__ == "__main__":
main(obj={})