Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 6f66438

Browse files
author
Irene
committed
Add docs for organization and update man
1 parent 213400e commit 6f66438

5 files changed

Lines changed: 75 additions & 26 deletions

File tree

docs/MANUAL.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,10 @@ COMMAND: SUBMIT
126126
`tmc` `submit` [`-a`] [`-d`] [`-c`] [*path*] ...
127127

128128
Submit exercises to the server. If no *path* is given, the exercise in the
129-
current working directory will be submitted. Several exercises can be submitted
130-
at once. If the current work directory is the course root directory or the
131-
course root directory was given as a *path*, then all exercises will be submitted.
129+
current working directory will be submitted. The submittable exercise(s) must be given as an argument.
132130

133131
For every successful submission, you'll be prompted to send feedback for the
134-
exercise if the course has enabledfeedback questions. Sending feedback is
132+
exercise if the course has enabled feedback questions. Sending feedback is
135133
always optional.
136134

137135
`-a` `--all`
@@ -192,7 +190,7 @@ Set or unset TMC-CLI properties. Only accepts certain keys. If not invoked with
192190
Do not ask for confirmations or print out set values.
193191

194192
`-l` `--list`
195-
List all current properties.
193+
List all current settings.
196194

197195
`-g` `--get=KEY` or `--get KEY`
198196
Get the value of a specific key.
@@ -209,7 +207,17 @@ List of configurable settings:
209207
* *send-analytics*
210208
Allow sending analytics data of commands run. Stored in account.
211209
* *server-address*
212-
Address to fetch courses from and submit to. Defaults to `https://tmc.mooc.fi`. Stored with account
210+
Address to fetch courses from and submit to. Defaults to `https://tmc.mooc.fi`. Stored with account.
211+
212+
COMMAND: ORGANIZATION
213+
---------------
214+
215+
`tmc` `organization` [`-o`][*slug*] ...
216+
217+
Change organization, which determines the downloadable courses. If no slug is given, or the slug is invalid, all available organizations are listed, and the user will be prompted to choose one.
218+
219+
`-o` `--organization`
220+
Change organization to slug given as an argument without the listing of all organizations.
213221

214222
---
215223

docs/tmc.1

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,12 @@ with a command, display a help message for that command.
3434
\l'\n(.lu'
3535
.SH COMMAND: LOGIN
3636
.PP
37-
\fB\fCtmc\fR \fB\fClogin\fR [\fB\fC\-s\fR \fIserver address\fP] [\fB\fC\-u\fR \fIusername\fP] [\fB\fC\-p\fR \fIpassword\fP]
37+
\fB\fCtmc\fR \fB\fClogin\fR [\fB\fC\-u\fR \fIusername\fP] [\fB\fC\-p\fR \fIpassword\fP]
3838
.PP
3939
Login to TMC server. If credentials are not given as options, the user will
4040
be asked to input any missing credentials. You will have to be logged in
4141
in order to use certain commands.
4242
.TP
43-
\fB\fC\-s\fR \fB\fC\-\-server\fR
44-
Specify which server to connect to.
45-
.TP
4643
\fB\fC\-u\fR \fB\fC\-\-user\fR
4744
Specify username.
4845
.TP
@@ -103,12 +100,12 @@ Display more detailed error messages.
103100
\fB\fCtmc\fR \fB\fCsubmit\fR [\fB\fC\-a\fR] [\fB\fC\-d\fR] [\fB\fC\-c\fR] [\fIpath\fP] ...
104101
.PP
105102
Submit exercises to the server. If no \fIpath\fP is given, the exercise in the
106-
current working directory will be submitted. Several exercises can be submitted
107-
at once. If the current work directory is the course root directory or the
108-
course root directory was given as a \fIpath\fP, then all exercises will be submitted.
103+
current working directory will be submitted. The submittable
104+
.BR exercise (s)
105+
must be given as an argument.
109106
.PP
110107
For every successful submission, you'll be prompted to send feedback for the
111-
exercise if the course has enabledfeedback questions. Sending feedback is
108+
exercise if the course has enabled feedback questions. Sending feedback is
112109
always optional.
113110
.TP
114111
\fB\fC\-a\fR \fB\fC\-\-all\fR
@@ -147,36 +144,62 @@ Do not send a message alongside the paste.
147144
.TP
148145
\fB\fC\-m\fR \fB\fC\-\-message\fR
149146
Give the message as an argument instead of opening a text editor.
150-
.SH COMMAND: PROP
147+
.SH COMMAND: CONFIG
151148
.PP
152-
\fB\fCtmc\fR \fB\fCprop\fR [\fIKEY\fP] [\fIVALUE\fP] ...
153-
\fB\fCprop\fR \fB\fC\-u\fR \fIKEY\fP ...
149+
\fB\fCtmc\fR \fB\fCconfig\fR \fB\fC[\-q]\fR[\fIKEY=VALUE\fP] ...
150+
\fB\fCconfig\fR \fB\fC\-d\fR \fB\fC[\-q]\fR [\fIKEY\fP] ...
151+
\fB\fCconfig\fR \fB\fC\-l\fR
152+
\fB\fCconfig\fR \fB\fC\-g\fR [\fIKEY\fP] or \fB\fC\-g\fR=[\fIKEY\fP]
154153
.PP
155-
Set or unset TMC\-CLI properties. Invoke without any arguments to display all
156-
current properties. If more than a single property is added or removed, the user
157-
will be asked to confirm the changes.
154+
Set or unset TMC\-CLI properties. Only accepts certain keys. If not invoked with the option \fB\fCquiet\fR will ask to confirm changes.
158155
.TP
159-
\fB\fC\-u\fR \fB\fC\-\-unset\fR
156+
\fB\fC\-d\fR \fB\fC\-\-delete\fR
160157
Unset given properties.
158+
.TP
159+
\fB\fC\-q\fR \fB\fC\-\-quiet\fR
160+
Do not ask for confirmations or print out set values.
161+
.TP
162+
\fB\fC\-l\fR \fB\fC\-\-list\fR
163+
List all current settings.
164+
.TP
165+
\fB\fC\-g\fR \fB\fC\-\-get=KEY\fR or \fB\fC\-\-get KEY\fR
166+
Get the value of a specific key.
161167
.PP
162-
List of properties:
168+
List of configurable settings:
163169
.RS
164170
.IP \(bu 2
165171
\fIupdate\-date\fP
166-
Scheduled time for the next version check.
172+
Scheduled time for the next version check. Stored in properties.
167173
.IP \(bu 2
168174
\fItestresults\-left\fP \fItestresults\-right\fP \fIprogressbar\-left\fP \fIprogressbar\-right\fP
169175
Change progress bar colours. Recognised values: black, red, green, yellow,
170-
blue, purple, cyan, white, none.
176+
blue, purple, cyan, white, none. Stored in properties.
177+
.IP \(bu 2
178+
\fIsend\-diagnostics\fP
179+
Allow sending crash reports and analytics for client development. Stored with account.
180+
.IP \(bu 2
181+
\fIsend\-analytics\fP
182+
Allow sending analytics data of commands run. Stored in account.
183+
.IP \(bu 2
184+
\fIserver\-address\fP
185+
Address to fetch courses from and submit to. Defaults to \fB\fChttps://tmc.mooc.fi\fR\&. Stored with account.
171186
.RE
187+
.SH COMMAND: ORGANIZATION
188+
.PP
189+
\fB\fCtmc\fR \fB\fCorganization\fR [\fB\fC\-o\fR][\fIslug\fP] ...
190+
.PP
191+
Change organization, which determines the downloadable courses. If no slug is given, or the slug is invalid, all available organizations are listed, and the user will be prompted to choose one.
192+
.PP
193+
\fB\fC\-o\fR \fB\fC\-\-organization\fR
194+
Change organization to slug given as an argument without the listing of all organizations.
172195
.ti 0
173196
\l'\n(.lu'
174197
.SH FILES
175198
.TP
176199
\fB\fC[course directory]/.tmc.json\fR
177200
Course configuration and cache file. Saves the status of the username, server
178201
address and course's exercises. Manually editing this file may have adverse
179-
effects.
202+
effects.
180203
.TP
181204
\fB\fC~/.config/tmc\-cli/properties.json\fR
182205
User configuration file. Use \fB\fCtmc prop\fR to edit properties.

src/main/java/fi/helsinki/cs/tmc/cli/backend/Account.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,20 @@ public boolean getSendDetailedAnalytics() {
137137
public void setSendDetailedAnalytics(boolean sendDetailedAnalytics) {
138138
this.sendDetailedAnalytics = false;
139139
}
140+
141+
@Override
142+
public String toString() {
143+
return "Account{" +
144+
"serverAddress='" + serverAddress + '\'' +
145+
", username='" + username + '\'' +
146+
", password='" + password + '\'' +
147+
", oauthCredentials=" + oauthCredentials +
148+
", currentCourse=" + currentCourse +
149+
", token='" + token + '\'' +
150+
", organization=" + organization +
151+
", sendDiagnostics=" + sendDiagnostics +
152+
", sendAnalytics=" + sendAnalytics +
153+
", sendDetailedAnalytics=" + sendDetailedAnalytics +
154+
'}';
155+
}
140156
}

src/main/java/fi/helsinki/cs/tmc/cli/command/ConfigCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
import java.util.*;
1919

20-
@Command(name = "config", desc = "Set/unset TMC-CLI properties")
20+
@Command(name = "config", desc = "Set/unset TMC-CLI properties and change settings")
2121
public class ConfigCommand extends AbstractCommand {
2222

2323
private CliContext context;

src/main/java/fi/helsinki/cs/tmc/cli/core/CliContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import fi.helsinki.cs.tmc.cli.io.*;
1212
import fi.helsinki.cs.tmc.cli.shared.CourseFinder;
1313
import fi.helsinki.cs.tmc.core.TmcCore;
14+
import fi.helsinki.cs.tmc.core.holders.TmcSettingsHolder;
15+
1416
import java.util.HashMap;
1517

1618
public class CliContext {

0 commit comments

Comments
 (0)