-
Notifications
You must be signed in to change notification settings - Fork 3
/
dbwebb2-usage.bash
267 lines (221 loc) · 6.75 KB
/
dbwebb2-usage.bash
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
function usage ()
{
local txt=(
"Utility dbwebb for working with course repos: https://dbwebb.se/dbwebb-cli"
"Usage: dbwebb [options] <command> [arguments]"
""
"Command:"
" check Check the environment."
" config (Re-)Create config file."
" selfupdate [version] Update to latest (or selected) version."
" sshkey Create and install ssh-keys."
" login Login to the remote server."
" clone [repo] Clone a course repo."
" init Init course repo and remote server."
" github [repo] Get urls to repo on GitHub."
" update Update course repo."
" upload [part] Upload to server."
" download [part] Download from server."
" create <lab> [version] Create a lab using optional version."
" recreate <lab> Re-create lab with optional version."
" validate [part] Validate it."
" test [part] [options] Run testsuite for the kmom or its part."
" publish [part] Publish it."
" publishfast [part] Publish without validation."
" publishpure [part] Publish without minification."
" inspect [course] [kmom] [user] Inspect a kmom."
" run <command> Run a command on remote host."
" trouble Troubleshoot your installation."
" gui help|<command> Gui to do inspect."
" exam help|<command> Work (checkout and hand in) with exams."
" testrepo Automated tests of a course repo."
" version Alternative to --version."
" help Alternative to --help."
""
"Options:"
" --inspect, -i Help for inspect."
" --verbose, -v More verbose."
" --silent, -s Less verbose output."
" --force, -f Force upload/download of files, overwrite existing."
" --local, -l Only local tests in command testrepo."
" --host Host to connect to (supported by run)."
" --cwd Working dir for command (supported by run)."
" --with-curl Prefer to use curl (where supported)."
" --with-lynx Prefer to use lynx (where supported)."
" --dry Dry run (supported by validate/publish)."
" --no-validate Skip validation when --yes in inspect."
" --help, -h Print help."
" --version Print version."
)
printf "%s\n" "${txt[@]}"
}
function badUsage ()
{
local message="$1"
local txt=(
"For an overview of the command, execute:"
"dbwebb --help"
)
if [[ "$message" ]]; then
printf "$message\n"
fi
printf "%s\n" "${txt[@]}"
}
function usageGithub ()
{
local txt=(
"Available course repos are: $( join , "${DBW_COURSE_REPOS[@]}" )"
"Usage: dbwebb github [course repo]"
""
"The repo 'dbwebb-cli' exists on GitHub."
"Repo: $( createGithubUrl "$DBW_REPO" )"
"Issues: $( createGithubUrl "$DBW_REPO" "/issues" )"
)
printf "%s\n" "${txt[@]}"
}
function badUsageGithub ()
{
local message="$1"
if [[ "$message" ]]; then
printf "$message\n"
fi
usageGithub
}
function usageClone ()
{
local txt=(
"Available course repos are: $( join , "${DBW_COURSE_REPOS[@]}" )"
"Usage: dbwebb clone [course repo]"
"Read more: http://dbwebb.se/dbwebb-cli/clone"
)
printf "%s\n" "${txt[@]}"
}
function badUsageClone ()
{
local message="$1"
if [[ "$message" ]]; then
printf "$message\n"
fi
usageClone
}
function usageInspect ()
{
local txt=(
"dbwebb inspect:"
"Use to inspect a kmom, as the teachers does, self inspect your own kmom before handing it in."
""
"Usage: dbwebb inspect <kmom>"
"Use to self inspect a kmom in current course repo. This will also upload all your files to the remote server to ensure you are checking the latest code."
""
"Usage: dbwebb inspect <course> <kmom>"
"Use to inspect a kmom in any course repo that is uploaded to the remote server. No need of being in a valid course repo. No upload of files."
""
"Usage: dbwebb inspect <course> <kmom> <user>"
"Use to inspect a kmom in any course for any user, without the need of being in a valid course repo. No upload of files."
)
printf "%s\n" "${txt[@]}"
}
function version ()
{
local txt=(
"dbwebb version $DBW_VERSION"
)
printf "%s\n" "${txt[@]}"
}
function inspectUsage ()
{
local txt=(
"Using dbwebb inspect, for another student than youreself,"
"needs extra privilegies."
""
"Add acronym for inspect"
" sudo /usr/local/sbin/setpre-dbwebb-kurser.bash acronym"
""
"or add as an alias in your .cshrc"
" dbwebb run echo 'alias potatoe \"sudo setpre-dbwebb-kurser.bash\"' >> .cshrc"
""
"and then run as this:"
" dbwebb run potatoe akronym"
""
"Add or delete teacher (on each server)"
" sudo update-dbwebb-kurser.bash -a acronym"
" sudo update-dbwebb-kurser.bash -d acronym"
""
"Change owner to mosstud of all files in the archive"
" sudo /usr/local/sbin/setowner-on-dbwebb-archive.bash"
""
"Add --yes to answer yes/default answer to all questions."
""
" Add --port port, -p port to execute external servers on this port."
""
"Add --useVersion 1 to use a specific version of the course. Useful when courses has several versions and same repo must be used for all versions."
""
"Execute command as the user dbwebb."
" sudo -u dbwebb script"
)
printf "%s\n" "${txt[@]}"
}
function usageExam ()
{
local txt=(
"Work with exams."
"Usage: dbwebb [options] exam <command> [arguments]"
""
"Command:"
" correct Correct the exam (if supported)."
" help Print this help and usage message."
" list|ls View Active, Planned and Passed exams."
" receipt <target> Get the receipt for an exam."
" start|checkout <target> Checkout an exam and start working with it."
" stop|seal <target> Seal and hand in the exam once you are done."
""
"Options:"
" --baseurl <url> Use baseurl for request, instead of configuration."
" --dry Dry run."
" --silent, -s Less verbose output."
" --verbose, -v More verbose."
)
printf "%s\n" "${txt[@]}"
}
function badUsageExam ()
{
local message="$1"
local txt=(
"For an overview of the command, execute:"
"dbwebb exam help"
)
if [[ "$message" ]]; then
printf "$message\n"
fi
printf "%s\n" "${txt[@]}"
}
function usageGui ()
{
local txt=(
"Work with gui inspect."
"Usage: dbwebb [options] gui <command> [arguments]"
""
"Command:"
" config Maintain the user configuration file."
" install|selfupdate Download and install."
" help Print this help and usage message."
" version Print the current version."
""
"Options:"
" --silent, -s Less verbose output."
" --verbose, -v More verbose."
)
printf "%s\n" "${txt[@]}"
}
function badUsageGui ()
{
local message="$1"
local txt=(
"For an overview of the command, execute:"
"dbwebb gui help"
)
if [[ "$message" ]]; then
printf "$message\n"
fi
printf "%s\n" "${txt[@]}"
}